def get_supplypointstatuses(self, domain, facility=None, **kwargs): meta, supplypointstatuses = self.get_objects( self.supplypointstatuses_url, **kwargs) location = None if facility: try: location = SQLLocation.objects.get(domain=domain, external_id=facility) except SQLLocation.DoesNotExist: return meta, [] statuses = [] for supplypointstatus in supplypointstatuses: if not location: try: location = SQLLocation.objects.get( domain=domain, external_id=supplypointstatus['supply_point']) statuses.append( SupplyPointStatus.wrap_from_json( supplypointstatus, location)) except SQLLocation.DoesNotExist: continue else: statuses.append( SupplyPointStatus.wrap_from_json(supplypointstatus, location)) return meta, statuses
def get_supplypointstatuses(self, domain, facility, **kwargs): meta, supplypointstatuses = self.get_objects(self.supplypointstatuses_url, **kwargs) try: location_id = SQLLocation.objects.get(domain=domain, external_id=facility).location_id return meta, [SupplyPointStatus.wrap_from_json(supplypointstatus, location_id) for supplypointstatus in supplypointstatuses] except SQLLocation.DoesNotExist: return None, None
def get_supplypointstatuses(self, domain, facility=None, **kwargs): meta, supplypointstatuses = self.get_objects(self.supplypointstatuses_url, **kwargs) location = None if facility: try: location = SQLLocation.objects.get(domain=domain, external_id=facility) except SQLLocation.DoesNotExist: return meta, [] statuses = [] for supplypointstatus in supplypointstatuses: if not location: try: location = SQLLocation.objects.get(domain=domain, external_id=supplypointstatus["supply_point"]) statuses.append(SupplyPointStatus.wrap_from_json(supplypointstatus, location)) except SQLLocation.DoesNotExist: continue else: statuses.append(SupplyPointStatus.wrap_from_json(supplypointstatus, location)) return meta, statuses
def get_supplypointstatuses(self, domain, facility, **kwargs): meta, supplypointstatuses = self.get_objects(self.supplypointstatuses_url, **kwargs) location_id = _get_location_id(facility, domain) return meta, [SupplyPointStatus.wrap_from_json(supplypointstatus, location_id) for supplypointstatus in supplypointstatuses]