def get_earliest_event_id(self, event, filter): filter = deepcopy(filter) filter.conditions = filter.conditions or [] filter.conditions.extend(get_before_event_condition(event)) filter.end = event.datetime return self.__get_event_id_from_filter(filter=filter, orderby=ASC_ORDERING)
def get_prev_event_id(self, event, filter): """ Returns (project_id, event_id) of a previous event given a current event and a filter. Returns None if no previous event is found. """ assert filter, "You must provide a filter" if not event: return None filter = deepcopy(filter) filter.conditions = filter.conditions or [] filter.conditions.extend(get_before_event_condition(event)) filter.end = event.datetime return self.__get_event_id_from_filter(filter=filter, orderby=DESC_ORDERING)