def get_spawnpoints_stats(self): coords = [] known = [] unknown = [] processed_fences = [] possible_fences = get_geofences(self._mapping_manager, 'mon_mitm') for possible_fence in possible_fences: for subfence in possible_fences[possible_fence]['include']: if subfence in processed_fences: continue processed_fences.append(subfence) fence = generate_coords_from_geofence(self._mapping_manager, subfence) known.clear() unknown.clear() data = json.loads(self._db.download_spawns(fence=fence)) for spawnid in data: if data[str(spawnid)]["endtime"] == None: unknown.append(spawnid) else: known.append(spawnid) coords.append({ 'fence': subfence, 'known': len(known), 'unknown': len(unknown), 'sum': len(known) + len(unknown) }) stats = {'spawnpoints': coords} return jsonify(stats)
def get_quests(self): coords = [] fence = request.args.get("fence", None) if fence not in (None, 'None', 'All'): fence = generate_coords_from_geofence(self._mapping_manager, fence) else: fence = None neLat, neLon, swLat, swLon, oNeLat, oNeLon, oSwLat, oSwLon = getBoundParameter( request) timestamp = request.args.get("timestamp", None) data = self._db.quests_from_db(neLat=neLat, neLon=neLon, swLat=swLat, swLon=swLon, oNeLat=oNeLat, oNeLon=oNeLon, oSwLat=oSwLat, oSwLon=oSwLon, timestamp=timestamp, fence=fence) for stopid in data: quest = data[str(stopid)] coords.append(generate_quest(quest)) return jsonify(coords)