CSC/ECE 517 Fall 2016/E1657. Introduce a Student View for instructors
Introduction
Our project is to introduce a Student view to the instructors.
Project Requirements
- Introduce a "Student View Button" on Instructors UI to switch to student view.
- Introduce a Revert to instructor View" on Instructor's Student UI
- Time travel in Student View.
The goal of this project is to provide instructor with a functionality using which an instructor can switch to student view and see how the student view looks like. The instructor will also be able to go to future date and see how student view looks like in future date.
Working
On the right top, left to the logout button , anyone having access to view as instructor gets a textbox and a button saying "view as student". In-order to view as a student you have to type in the students ID and press submit. You can exactly see what the student's page looks like. If you need to revert back to instructor view you just have to leave the text box empty and press the revert button. This takes you to the instructors view again. Else if you need another students view, just type in the students ID and submit.
We also have implemented a time travel feature where you can go to a particular date and see what a student see on that day. You can find this feature as soon as you go to a student ID. You have to select a day you need to travel to, type in the student ID and submit. Boom! you got he student view as on the date given.
Implementation
- Introduce a "Switch to Student View Button" on Instructors UI
A 'Student View' button was added in the top right portion of menu-bar for instructor. This button allows instructor to see the student view. This button
is linked to impersonate action of Impersonate_controller. The button was simply added in menu-bar view. When the button is clicked, it calls impersonate method in impersonate controller which loads new view as student for provided student id. Once the student view is loaded by instructor,session[superuser] is set and based on this flag a revert button will be displayed.
Required changes in 1 files :
navigation.html
- Introduce a Revert to instructor View" on Instructor's Student UI
Once instructor impersonate to a student view, a Revert button appears which when clicked revert back to instructor view from impersonated student view.
- Time travel in Student View.
Required changes in 4 files :
navigation.html
First, we introduced a date box where you can select a date from the UI.
Impersonate_controller
In this controller, we took the value from UI and store the same in User model.
user.rb
The value from the above controller is stored in Users model object (not instance) as goto_date. Thus you can access this date through out the sessions.
due_date.rb
When ever the system calculates due dates, the time is taken from goto_date that we have stored above in Users model.