Giter VIP home page Giter VIP logo

schoolboardlaravel's Introduction

School Board Test

Author: Denis Kovacevic

Task

You have to design a system that is responsible for the managing the grades for a list of students. You should be able to calculate the average of the grades for a given student, identify if he has passed or failed and notify the school board of the results. Each school board can have a different rule to calculate if he has passed or not and which format (JSON, XML) it accepts each student notification. Provide unit tests for the relevant parts of the system.

Notes:

A student is registered with only one school board. A student can have 1 to 4 grades
Don’t worry about UI of the list of students or grades. You can use SQLite if you want for the persistence
Implement two school boards, CSM and CSMB CSM considers pass if the average is bigger or equal to 7 and fail otherwise.
Accepts JSON format CSMB discards the lowest grade, if you have more than 2 grades. Accepts XML format The usage, at the higher level is expected to be as simple as this (initialization, error handling and actual names of the methods left as part of the exercise)

$average = $schoolSystem->methodThatCalculatesTheAverage(…);
$schoolSystem->methodThatTransferTheStudentResult(…);

Each student result, either XML or JSON, will contain the student id, name, list of grades, average and final result (Fail, Pass)
The school board is an external system so don’t worry about its actual implementation. For this example you can simply log what would be the result transmitted.
The transmission can fail and your system should log this (standard output for simplicity) Use Laravel 5.1+

Installation

Create .env, example .env

APP_ENV=local
APP_KEY=base64:wcAU8oO/FHOXbL4en1p9khpzzl+4qoaw/gRyhiHpL1c=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://mgtest.local

DB_CONNECTION=sqlite

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

BOARD_PASS_LIMIT=7
BOARD_REMOVE_LOWEST_LIMIT=2

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=

Create sqlite DB

    touch database/database.sqlite

Set permissions for storage and cache folders

    sudo chmod -R 777 bootstrap/cache/
    sudo chmod -R 777 storage/

Install dependencies and dump-autoload

    composer install
    composer dump-autoload

DB migration

    php artisan migrate

Seed database

php artisan db:seed

API END POINTS

http://mgtest.local/api/board/CSMB/students
http://mgtest.local/api/board/CSM/students
http://mgtest.local/api/student/1

schoolboardlaravel's People

Watchers

James Cloos avatar Denis Kovacevic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.