From 867af85e0d47b103823560f1ea5d4cb0b6d27e98 Mon Sep 17 00:00:00 2001 From: fsoest Date: Sat, 11 Jan 2025 11:10:22 +0100 Subject: [PATCH] Modify module cleanup to check for new modules --- S1/waitinglists/management/commands/module_cleanup.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/S1/waitinglists/management/commands/module_cleanup.py b/S1/waitinglists/management/commands/module_cleanup.py index ae9e597..f0aaa43 100644 --- a/S1/waitinglists/management/commands/module_cleanup.py +++ b/S1/waitinglists/management/commands/module_cleanup.py @@ -1,6 +1,7 @@ from django.core.management.base import BaseCommand from django.utils import timezone from waitinglists.models import Module, QuizCompletion, WaitingList +from waitinglists.views import module_2_completion from django.contrib.auth.models import User import os @@ -37,6 +38,9 @@ def handle(self, *args, **kwargs): module_1_completion_date = WaitingList.objects.get( module=mod1, user__username=user ).date_completed + if timezone.now() - module_1_completion_date < timezone.timedelta(days=40): + continue + module_2_completion(User.objects.get(username=user), fetch=True) completions = list( QuizCompletion.objects.filter(user__username=user).order_by( "date_completed"