Skip to content

Add datetime to challenges

Olaf Erkemeij requested to merge challenges_add_datetime into master

Change the way challenges are stored in the database, now using datetime instead of a date. This allows for specifying exact times a challenge should start and end. It should be noted that the time on the server is 1 hour behind local time, so setting a start time for a challenge can be confusing.

Database migration was successful, existing challenges automatically get their dates converted into datetimes set at midnight.

UPDATE 36cee264: Updated the database to add timezones to the database, adjusted front-end to format times according to the user's local time. To check if a challenge is open, the timestamps are compared to the current time formatted to the Europe/Amsterdam timezone.

UPDATE 50b53085: Merged the two revisions into one file. Also added a timezone to a comparison to prevent a potential error in comparing time-zone aware and naive datetimes. Remarkably, this error did not occur, presumably since sqlalchemy does some automatic type conversions. Nevertheless, the timezone was added for consistency.

UPDATE 9e8410be: Updated the existing tests to use timezones, and added a file which tests some more of the services provided by the challenge_service.

Edited by Olaf Erkemeij

Merge request reports