Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[STTNHUB-256] fix(ingest): Set all_day & no_end_time to False when required #1871

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading