[residentadvisor] search by ticket status

This commit is contained in:
Alexandre Morignot 2014-11-27 15:40:17 +01:00
commit 3c1b69fdea

View file

@ -135,22 +135,26 @@ class ResidentadvisorModule(Module, CapCalendarEvent):
if not self.has_matching_categories(query): if not self.has_matching_categories(query):
raise StopIteration() raise StopIteration()
events = None
if query.city: if query.city:
# FIXME # FIXME
# we need the country to search the city_id in an efficient way # we need the country to search the city_id in an efficient way
city_id = self.browser.get_city_id(query.city) city_id = self.browser.get_city_id(query.city)
for event in self.browser.get_events(city = city_id): events = self.browser.get_events(city = city_id)
yield event
elif query.summary: elif query.summary:
for event in self.browser.search_events_by_summary(query.summary): events = self.browser.search_events_by_summary(query.summary)
yield event
else: else:
for event in self.list_events(query.start_date, query.end_date): events = self.list_events(query.start_date, query.end_date)
for event in events:
event = self.fillobj(event, ['ticket'])
if event.ticket in query.ticket:
yield event yield event
def fill_event(self, event, fields): def fill_event(self, event, fields):
if set(fields) & set(('end_date', 'price', 'description')): if set(fields) & set(('end_date', 'price', 'description', 'ticket')):
return self.get_event(event.id) return self.get_event(event.id)
return event return event