aboutsummaryrefslogtreecommitdiff
path: root/management
diff options
context:
space:
mode:
authorAlban Gruin2017-01-20 14:40:19 +0100
committerAlban Gruin2017-01-20 14:40:19 +0100
commitdf2b69af6923aa9ef00e4e3070a28906b17593fc (patch)
treeb61ad3f816a362b4d41e58c7d8c5543fce67fee5 /management
parenta4c9f9027c443a32ff3475dc292c7495f685b651 (diff)
Déduplication de la fonction get_week()
Diffstat (limited to 'management')
-rw-r--r--management/commands/_private.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/management/commands/_private.py b/management/commands/_private.py
index 65772a4..f5a3ebc 100644
--- a/management/commands/_private.py
+++ b/management/commands/_private.py
@@ -1,6 +1,8 @@
from bs4 import BeautifulSoup
from django.utils import timezone
+
from edt.models import Group, Room, Course
+from edt.utils import get_week
import datetime
import requests
@@ -23,10 +25,7 @@ def add_time(date, time):
return date + delta
def delete_courses_in_week(timetable, year, week):
- start = timezone.make_aware(datetime.datetime.strptime(
- "{0}-W{1:02d}-1".format(year, week), "%Y-W%W-%w"))
- end = start + datetime.timedelta(weeks=1)
-
+ start, end = get_week(year, week)
Course.objects.filter(begin__gte=start, begin__lt=end,
timetable=timetable).delete()