Skip to content
This repository has been archived by the owner on May 20, 2019. It is now read-only.

Convert week numbers into dates on mentor spreadsheet #31

Open
attang opened this issue Mar 21, 2016 · 0 comments
Open

Convert week numbers into dates on mentor spreadsheet #31

attang opened this issue Mar 21, 2016 · 0 comments
Assignees

Comments

@attang
Copy link
Contributor

attang commented Mar 21, 2016

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
    1. mentor_show method corresponds to attendance view from the mentor side
    2. show method corresponds to attendance view from student side
  • app/views/attendances/show.html.erb
    1. Line 10 shows a week number
    2. Line 50 also shows a week number
  • app/views/attendances/mentor_show.html.erb
    1. 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.

@attang attang assigned kstukalova and attang and unassigned kstukalova and attang Mar 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants