Skip to content

Commit

Permalink
Modify module cleanup to check for new modules
Browse files Browse the repository at this point in the history
  • Loading branch information
fsoest committed Jan 11, 2025
1 parent 6e6c49f commit 867af85
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions S1/waitinglists/management/commands/module_cleanup.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 867af85

Please sign in to comment.