NIAEFEUP / tts-be

A platform where students can experiment with the possible combination of schedule options they can pick at the start of the semester
https://tts.niaefeup.pt
5 stars 1 forks source link

Sqlite setup #65

Closed dsantosferreira closed 11 months ago

dsantosferreira commented 1 year ago

Closes #52

What was done

This PR creates a SQLite table to hold the statistics for which majors use TTS the most according to #45. A dump of that table is created at midnight and noon in UTC using Celery and Celery-beat.

What can be improved

The Celery setup that we currently have is the simplest it can be. That said, there is a better setup for django that I have tried to implement but unfortunately I couldn't get it to work. This django setup, although not completely necessary for what we have now, would make the code more organized if we use Celery for more features. I have created an issue #64 to try to use the django configuration for celery.

Testing

To test this PR you can change the local time on your PC to 12:59 (11:59 in UTC) and 00:59 (23:59 in UTC) to make sure that a dump is created exactly at midnight and noon. You can also temporarily remove the arguments in the crontab function in tasks.py so that the dump is created every minute. A file named statistics.sql should be created in tts-be/django/statistics.sql

dsantosferreira commented 1 year ago

Now that the statistics are stored in the mysql table, the statistics class doesn't seem necessary. Is it ok to remove it @SergioEstevao11 @ZeAntonioM?

The issue seems to be complete and ready to be reviewed