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

MT: events: os-core does not consider location for duplicates #5125

Merged
merged 2 commits into from
Dec 10, 2024
Merged
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
10 changes: 3 additions & 7 deletions scrapers/mt/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def scrape_event(self, url: str):

# Check if event already exists in the self._events list
# and if so, add data to that instead of creating duplicate
existing_event = self.check_for_existing_event(title, location, when)
existing_event = self.check_for_existing_event(title, when)
if existing_event is None:
# No existing event found, create one
event = Event(
Expand Down Expand Up @@ -112,14 +112,10 @@ def scrape_event(self, url: str):
self._events.append(event)

def check_for_existing_event(
self, title: str, location_name: str, start_date: datetime.datetime.date
self, title: str, start_date: datetime.datetime.date
) -> Union[Event, None]:
for event in self._events:
if (
event.name == title
and event.location["name"] == location_name
and event.start_date == start_date
):
if event.name == title and event.start_date == start_date:
return event

return None
Expand Down
Loading