YACS-RCOS / yacs

Yacs - The Scheduler for Everyone
https://yacs.io
GNU Affero General Public License v3.0
69 stars 58 forks source link

Change representation of times in the database to minutes since start of week #102

Open copperwater opened 8 years ago

copperwater commented 8 years ago

The current storage of times in the database (for periods) is a 4-digit military time. This is annoying to deal with on both the backend and frontend because it has to be parsed into a format that recognizes the second pair of digits cannot exceed 60. We want to change that number from the military time format to the simple quantity of minutes since midnight (0 - 1439) to eliminate this parsing. This should only require a tweak to the parsing script and a reset of the database.

copperwater commented 8 years ago

This will also require at the same time the Javascript parsing of the military time into the minutes since midnight to be removed, so I am also tagging this as Frontend.

copperwater commented 8 years ago

There are a couple places in the sections model that require int conversions because time is currently represented as a string. Once it is in minutes since midnight format, its database representation should become int, and these conversions should be removed.

The specific instance is the to_i conversions in the conflicts_with function in app/models/section.rb.

copperwater commented 7 years ago

@Bad-Science and I have agreed that it would be simpler just to use minutes since the start of the week, removing the need for a periods_day field in the database. Front ends can then get the day of the week by dividing by 1440, and the minutes in that day by modulus 1440.