diff options
author | Alban Gruin | 2019-01-03 01:00:15 +0100 |
---|---|---|
committer | Alban Gruin | 2019-01-03 01:00:15 +0100 |
commit | 0e5bba4be1a7517de6322112d22c135d8a88fc7c (patch) | |
tree | 5e9bb1bdb05f4081cc1e4480cf96b668c37e7fd9 | |
parent | cc92838a22eeb406474f7f5fa48eb42fa5ee4e4f (diff) |
Revert "ups2018: get_weeks() retourne la vraie liste des semaines présentes"ag/ups2018-liste-semaines
This reverts commit cc92838a22eeb406474f7f5fa48eb42fa5ee4e4f.
-rw-r--r-- | management/parsers/ups2018.py | 25 |
1 files 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("<br>") 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("<br>") - - 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): |