def get_case_ids_for_owner(self, owner_id): if self.is_clean(owner_id): if self.restore_state.is_initial: # for a clean owner's initial sync the base set is just the open ids return set(get_open_case_ids(self.restore_state.domain, owner_id)) else: # for a clean owner's steady state sync, the base set is anything modified since last sync return set(get_case_ids_modified_with_owner_since( self.restore_state.domain, owner_id, self.restore_state.last_sync_log.date )) else: # todo: we may want to be smarter than this # right now just return the whole footprint and do any filtering later return get_case_footprint_info(self.restore_state.domain, owner_id).all_ids
def get_case_footprint_info(domain, owner_id): """ This function is duplicating a lot of functionality in get_footprint/get_related_cases. However it is unique in that it: 1) starts from an owner_id instead of a base set of cases 2) doesn't return full blown case objects but just IDs 3) differentiates between the base set and the complete list """ all_case_ids = set() # get base set of cases (anything open with this owner id) open_case_ids = get_open_case_ids(domain, owner_id) new_case_ids = set(open_case_ids) while new_case_ids: all_case_ids = all_case_ids | new_case_ids referenced_case_ids = get_indexed_case_ids(domain, list(new_case_ids)) new_case_ids = set(referenced_case_ids) - all_case_ids return FootprintInfo(base_ids=set(open_case_ids), all_ids=all_case_ids)
def get_case_footprint_info(domain, owner_id): """ This function is duplicating a lot of functionality in get_footprint/get_related_cases. However it is unique in that it: 1) starts from an owner_id instead of a base set of cases 2) doesn't return full blown case objects but just IDs 3) differentiates between the base set and the complete list """ all_case_ids = set() # get base set of cases (anything open with this owner id) open_case_ids = get_open_case_ids(domain, owner_id) new_case_ids = set(open_case_ids) while new_case_ids: all_case_ids = all_case_ids | new_case_ids referenced_case_ids = get_indexed_case_ids(domain, list(new_case_ids)) new_case_ids = set(referenced_case_ids) - all_case_ids return FootprintInfo(base_ids=set(open_case_ids), all_ids=all_case_ids)
def get_open_case_ids_for_owner(domain, owner_id): return get_open_case_ids(domain, owner_id)
def get_open_case_ids_for_owner(domain, owner_id): return get_open_case_ids(domain, owner_id)