From 773e6e8a82756dae862e730c691c75250a2e4489 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Wed, 6 Sep 2017 14:30:37 +0200 Subject: Disruption du fonctionnement de LastUpdate. Au lieu de stocker seulement la date de la dernière mise à jour, on stocke toutes les mises à jour. --- management/commands/timetables.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'management') diff --git a/management/commands/timetables.py b/management/commands/timetables.py index d596233..0984c92 100644 --- a/management/commands/timetables.py +++ b/management/commands/timetables.py @@ -39,13 +39,10 @@ def process_timetable_week(timetable, year, week, soup, weeks_in_soup): course.save() date = timezone.make_aware(datetime.datetime.now()) - try: - last_update = LastUpdate.objects.get(timetable=timetable, year=year, week=week) - last_update.date = date - except: - last_update = LastUpdate(timetable=timetable, year=year, week=week, date=date) - finally: - last_update.save() + + Course.objects.filter(checked=True).update(checked=False) + last_update = LastUpdate(timetable=timetable, year=year, week=week, date=date) + last_update.save() def process_timetable(timetable, year, weeks): soup = get_xml(timetable.url) -- cgit v1.2.1