Skip to content

Commit

Permalink
[STTNHUB-256] fix(ingest): Set all_day & no_end_time to False when re…
Browse files Browse the repository at this point in the history
…quired (#1871)
  • Loading branch information
MarkLark86 authored Oct 25, 2023
1 parent b4b6421 commit c377b03
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
6 changes: 2 additions & 4 deletions server/planning/feed_parsers/events_ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,8 @@ def parse_event_schedule(self, dates, item):
tz=tz,
)

if all_day:
item["dates"]["all_day"] = all_day
elif no_end_time:
item["dates"]["no_end_time"] = no_end_time
item["dates"]["all_day"] = all_day
item["dates"]["no_end_time"] = (not all_day and no_end_time) is True

def parse_registration_details(self, event_details, item):
event_type = get_planning_schema("event")
Expand Down
6 changes: 6 additions & 0 deletions server/planning/feed_parsers/events_ml_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def get_item_dates(start: str, end: Optional[str] = None):
start=datetime(2022, 7, 5, 15, 0, tzinfo=utc),
end=datetime(2022, 7, 5, 17, 0, tzinfo=utc),
tz=self.app.config["DEFAULT_TIMEZONE"],
all_day=False,
no_end_time=False,
),
)

Expand All @@ -165,6 +167,8 @@ def get_item_dates(start: str, end: Optional[str] = None):
start=datetime(2022, 7, 5, 15, 0, tzinfo=utc),
end=datetime(2022, 7, 5, 16, 0, tzinfo=utc),
tz=self.app.config["DEFAULT_TIMEZONE"],
all_day=False,
no_end_time=False,
),
)

Expand All @@ -175,6 +179,7 @@ def get_item_dates(start: str, end: Optional[str] = None):
start=datetime(2022, 7, 5, 0, 0, tzinfo=utc),
end=datetime(2022, 7, 5, 23, 59, 59, tzinfo=utc),
all_day=True,
no_end_time=False,
tz=None,
),
)
Expand All @@ -187,6 +192,7 @@ def get_item_dates(start: str, end: Optional[str] = None):
start=datetime(2022, 7, 5, 0, 0, tzinfo=utc),
end=datetime(2022, 7, 7, 23, 59, 59, tzinfo=utc),
all_day=True,
no_end_time=False,
tz=None,
),
)
Expand Down
2 changes: 2 additions & 0 deletions server/planning/feed_parsers/onclusive.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,14 @@ def parse_event_details(self, event, item):
end=max(start_date, end_date),
no_end_time=True,
tz=tz,
all_day=False,
)
else:
item["dates"] = dict(
start=self.datetime(event["startDate"], "00:00:00"),
end=self.datetime(event["endDate"], "00:00:00"),
all_day=True,
no_end_time=False,
)

def parse_timezone(self, start_date, event):
Expand Down
1 change: 1 addition & 0 deletions server/planning/feed_parsers/onclusive_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def test_cst_timezone(self):
{
"start": datetime.datetime(2023, 4, 18, 2, tzinfo=datetime.timezone.utc),
"end": datetime.datetime(2023, 4, 18, 2, tzinfo=datetime.timezone.utc),
"all_day": False,
"no_end_time": True,
"tz": "Asia/Macau",
},
Expand Down

0 comments on commit c377b03

Please sign in to comment.