You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 20, 2019. It is now read-only.
Currently, the attendance views give an arbitrary week number that doesn't mean much to the viewer. Changing them to the Sunday of that week will give a better understanding of which attendance item corresponds to which week. This problem shows up on two pages - both the mentor and the student.
Relevant files to look at
app/controllers/attendances_controller.rb
mentor_show method corresponds to attendance view from the mentor side
show method corresponds to attendance view from student side
app/views/attendances/show.html.erb
Line 10 shows a week number
Line 50 also shows a week number
app/views/attendances/mentor_show.html.erb
Find the week numbers in here too and fix them.
I'd recommend starting scheduler up, and trying to find the two pages on your browser that corresponds to these two pages. Login with the admin account and enroll yourself to get to where you need to be. Then, you can refresh the page to see if works the way you want it to.
The current implementation is that each course object holds a variable called base_week, which stores a ruby datetime object that specifies when does each course start. The base_week is always the Sunday of the starting week. If the course does not have a specified base_week, it uses a global base_week stored in the Settings table instead.
To get the week number, there's a function called getCurrentWeek() which calculates the difference between the current datetime and the base_week datetime modulo 7.
Each attendance object also stores that week number. A lack of an attendance object means the student was unexcused.
I wouldn't recommend changing any existing code of the controller; rather add code by writing in a new method that function method_show and function show can call so that it can calculate the Sunday of the current week given a week number. Then update the view so that it shows that datetime rather than a simple number. You may need to look up on how to play around with datetime objects, which are built-in to Ruby.
The text was updated successfully, but these errors were encountered:
Currently, the attendance views give an arbitrary week number that doesn't mean much to the viewer. Changing them to the Sunday of that week will give a better understanding of which attendance item corresponds to which week. This problem shows up on two pages - both the mentor and the student.
Relevant files to look at
I'd recommend starting scheduler up, and trying to find the two pages on your browser that corresponds to these two pages. Login with the admin account and enroll yourself to get to where you need to be. Then, you can refresh the page to see if works the way you want it to.
The current implementation is that each course object holds a variable called base_week, which stores a ruby datetime object that specifies when does each course start. The base_week is always the Sunday of the starting week. If the course does not have a specified base_week, it uses a global base_week stored in the Settings table instead.
To get the week number, there's a function called getCurrentWeek() which calculates the difference between the current datetime and the base_week datetime modulo 7.
Each attendance object also stores that week number. A lack of an attendance object means the student was unexcused.
I wouldn't recommend changing any existing code of the controller; rather add code by writing in a new method that function method_show and function show can call so that it can calculate the Sunday of the current week given a week number. Then update the view so that it shows that datetime rather than a simple number. You may need to look up on how to play around with datetime objects, which are built-in to Ruby.
The text was updated successfully, but these errors were encountered: