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

LA Metro: Removing time as a necessity for partnering English/Spanish events #284

Merged
merged 4 commits into from
Aug 2, 2019
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
16 changes: 10 additions & 6 deletions lametro/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ def _merge_events(self, events):
web_event = LAMetroWebEvent(web_event)

if event.is_spanish:
try:
assert event.key not in spanish_events
except AssertionError:
raise AssertionError('{0} already exists as a key with a value of {1}'.format(event.key, spanish_events[event.key]))
spanish_events[event.key] = (event, web_event)
else:
english_events.append((event, web_event))
Expand All @@ -114,7 +118,7 @@ def _merge_events(self, events):
if web_event.has_audio:
event_audio.append(web_event['Audio'])

matches = spanish_events.get(event.partner_key, None)
matches = spanish_events.pop(event.partner_key, None)

if matches:
spanish_event, spanish_web_event = matches
Expand Down Expand Up @@ -155,7 +159,7 @@ def scrape(self, window=None) :
else:
event_name = body_name

# Events can have an EventAgendaStatusName of "Final", "Final Revised",
# Events can have an EventAgendaStatusName of "Final", "Final Revised",
# and "Final 2nd Revised."
# We classify these events as "passed."
status_name = event['EventAgendaStatusName']
Expand Down Expand Up @@ -209,7 +213,7 @@ def scrape(self, window=None) :
note = "Agenda number, {}".format(item["EventItemAgendaNumber"])
agenda_item['notes'].append(note)

# The EventItemAgendaSequence provides
# The EventItemAgendaSequence provides
# the line number of the Legistar agenda grid.
agenda_item['extras']['item_agenda_sequence'] = item['EventItemAgendaSequence']

Expand All @@ -222,7 +226,7 @@ def scrape(self, window=None) :
{event_name} on {event_date} ({legistar_api_url}). \
Contact Metro, and ask them to remove the duplicate EventItemAgendaSequence.'

raise ValueError(error_msg.format(event_name=e.name,
raise ValueError(error_msg.format(event_name=e.name,
event_date=e.start_date.strftime("%B %d, %Y"),
legistar_api_url=legistar_api_url))

Expand Down Expand Up @@ -329,11 +333,11 @@ def partner_search_string(self):

@property
def partner_key(self):
return (self._partner_name, self['EventDate'], self['EventTime'])
return (self._partner_name, self['EventDate'])

@property
def key(self):
return (self['EventBodyName'], self['EventDate'], self['EventTime'])
return (self['EventBodyName'], self['EventDate'])


class LAMetroWebEvent(dict):
Expand Down