From 0e5bba4be1a7517de6322112d22c135d8a88fc7c Mon Sep 17 00:00:00 2001
From: Alban Gruin
Date: Thu, 3 Jan 2019 01:00:15 +0100
Subject: Revert "ups2018: get_weeks() retourne la vraie liste des semaines
présentes"
This reverts commit cc92838a22eeb406474f7f5fa48eb42fa5ee4e4f.
---
management/parsers/ups2018.py | 25 +++++++------------------
1 file changed, 7 insertions(+), 18 deletions(-)
diff --git a/management/parsers/ups2018.py b/management/parsers/ups2018.py
index 6d39c8f..f1da5bf 100644
--- a/management/parsers/ups2018.py
+++ b/management/parsers/ups2018.py
@@ -92,7 +92,9 @@ class Parser(AbstractParser):
def __get_event(self, event, today,
beginning_of_month, end_of_month,
year, week):
- begin = event["begin"]
+ begin = timezone.make_aware(
+ datetime.strptime(event["start"], "%Y-%m-%dT%H:%M:%S")
+ )
end = timezone.make_aware(
datetime.strptime(event["end"], "%Y-%m-%dT%H:%M:%S")
)
@@ -106,7 +108,7 @@ class Parser(AbstractParser):
if event_year != year or event_week != week:
return
- data = event["data"]
+ data = event["text"].split("
")
rooms = None
if data[0] == "Global Event":
return
@@ -183,23 +185,10 @@ class Parser(AbstractParser):
return None # Pas de date de mise à jour dans ce format
def get_weeks(self):
- weeks = set()
- for i, month in enumerate(self.events):
- for event in month:
- begin = timezone.make_aware(
- datetime.strptime(event["start"], "%Y-%m-%dT%H:%M:%S")
- )
-
- data = event["text"].split("
")
-
- event["begin"] = begin
- event["data"] = data
-
- if data[0] != "Global Event":
- beginning, _ = get_week(*begin.isocalendar()[:2])
- weeks.add(beginning)
+ # FIXME: détection automatique à partir des événements présents
+ beginning, _ = get_week(*get_current_week())
+ self.weeks = {"1": beginning}
- self.weeks = {str(i + 1): week for i, week in enumerate(sorted(weeks))}
return self.weeks
def ajax_req(self, month):
--
cgit v1.2.1