A coding challenge to model students, teachers, lessons and students completing lessons in parts.
Solution is a web site backed by a Rails server.
https://students-education-rails.herokuapp.com/
A version of Ruby supported by Rails 5.0.0rc1. Ruby 2.3.1
during development.
-
clone this repository, then chang into the new directory
-
install the required gems:
bundle
-
create and seed the database
bundle exec rails db:setup
bundle exec rails s
The site will be available at http://localhost:3000
bundle exec spec
bundle exec rubocop
Company X is developing a new app for student education. Students complete lessons and their progress is recorded. Each lesson has 3 parts - 1, 2 and 3. There are 100 lessons in total.
Generate a rails app that persists students and their progress.
Define routes for:
- setting a student's progress - progress should consist of a lesson and part number.
- returning a JSON representation of a student and their associated progress.
Teachers have classes containing number of students.
- Add a teacher model that is related to students
- Create a reports page for a teacher to view progress all of their students.
Calculating progress
- add a method for updating student progress - this should verify that the student is only able to complete the next part number in sequence e.g. L1 P1, L1 P2, L1 P3, L2 P1, L2 P2 etc
- Tap
Students
in the top nav - Tap a student in the list
- Tap
Set progress
- You can enter a lesson number between 1 and 100 and a part between 1 and 3
- Tap Save
- Observe the student's progress has been updated
-
Request using curl:
curl https://students-education-rails.herokuapp.com/students/1.json
-
Observe the result:
{"student":{"id":1, "email":"[email protected]", "name":"Bart Simpson", "created_at":"2016-06-14T05:46:44.581Z", "updated_at":"2016-06-14T05:46:44.581Z", "school_class_id":1}, "progress":{}}
And for a student with progress:
curl https://students-education-rails.herokuapp.com/students/2.json
{"student":{"id":2, "email":"[email protected]", "name":"Lisa Simpson", "created_at":"2016-06-14T05:46:48.045Z", "updated_at":"2016-06-14T05:46:48.045Z", "school_class_id":2}, "progress":{"lesson":100, "part":3}}
- Tap
Teachers
in the top nav - Tap a teacher in the list
- Tap
Students taught
- Observe a list of students being taught by this teacher
(Solution is on the same page as the prior section)
- Tap
Teachers
in the top nav - Tap a teacher in the list
- Tap
Students taught
- Observe the progress of those students (down the right-hand-side)
(Solution is at the same place as Part 1 / (1.))
- Tap
Students
in the top nav - Tap a student in the list
- Tap
Set progress
- Enter a lesson or part number
- Tap Save
- Observe an error message
My first pass at this exercise was to create a Rails 5 API app that communicated json-api messages back and forth. The API side is complete and available on github as another example of my work. Building the new API stuff took longer than I expected and I ran short of time to implement an Ember front-end to it. Hence this repository (I started here by copying the models and schema from the v0.3 tag of the API repo).
More detail of the process I went through in the README.md in that repository.