Esempio n. 1
0
    def get_top_level_locations(self, characterIDs, regionID=None):
        asset_locations = self.filter(owner__in=characterIDs)

        if regionID:
            asset_locations = asset_locations.filter(regionID=regionID)

        asset_locations = asset_locations.distinct('locationID'). \
            values_list('locationID', flat=True)

        locations = [get_location(locationID) for locationID in asset_locations]

        out = []
        for location in locations:
            if type(location) is long:
                locationID = location
            else:
                locationID = location.pk

            out.append({'regionName': get_location_regionName(location),
                        'regionID': get_location_regionID(location),
                        'solarSystemName': get_location_solarSystemName(location),
                        'solarSystemID': get_location_solarSystemID(location),
                        'name': get_location_name(locationID),
                        'locationID': locationID})
        return out
Esempio n. 2
0
 def update_from_api(self, item, handler):
     self.compute_statistics()
     try:
         location = get_location(self.locationID)
         self.regionID = get_location_regionID(location)
         self.solarSystemID = get_location_solarSystemID(location)
     except:
         log.warning('Could not determine regionID or solarSystemID of locationID {0}.'.format(self.locationID))
Esempio n. 3
0
 def update_from_api(self, item, handler):
     self.compute_statistics()
     try:
         location = get_location(self.locationID)
         self.regionID = get_location_regionID(location)
         self.solarSystemID = get_location_solarSystemID(location)
     except:
         pass
Esempio n. 4
0
 def update_from_api(self, item, handler):
     self.compute_statistics()
     try:
         location = get_location(self.locationID)
         self.regionID = get_location_regionID(location)
         self.solarSystemID = get_location_solarSystemID(location)
     except:
         pass
Esempio n. 5
0
 def annotate_locations(self, asset_locations):
     for asset_location in asset_locations:
         locationID = asset_location['locationID']
         location_key = self._location_data_key(locationID)
         location_data = self._cache_get(location_key)
         if not location_data:
             location = get_location(locationID)
             location_data = {
                 'regionName': get_location_regionName(location),
                 'regionID': get_location_regionID(location),
                 'solarSystemName': get_location_solarSystemName(location),
                 'solarSystemID': get_location_solarSystemID(location),
                 'name': get_location_name(locationID)
             }
             self._cache_data(location_key, location_data)
         asset_location.update(location_data)
Esempio n. 6
0
 def annotate_locations(self, asset_locations):
     for asset_location in asset_locations:
         locationID = asset_location['locationID']
         location_key = self._location_data_key(locationID)
         location_data = self._cache_get(location_key)
         if not location_data:
             location = get_location(locationID)
             location_data = {
                 'regionName': get_location_regionName(location),
                 'regionID': get_location_regionID(location),
                 'solarSystemName': get_location_solarSystemName(location),
                 'solarSystemID': get_location_solarSystemID(location),
                 'name': get_location_name(locationID)
             }
             self._cache_data(location_key, location_data)
         asset_location.update(location_data)