aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--management/parsers/ups2018.py25
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):