MCPcopy Create free account
hub / github.com/RocketMap/RocketMap / get_appearances

Method get_appearances

pogom/models.py:204–222  ·  view source on GitHub ↗

:param pokemon_id: id of pokemon that we need appearances for :param timediff: limiting period of the selection :return: list of pokemon appearances over a selected period

(cls, pokemon_id, timediff)

Source from the content-addressed store, hash-verified

202
203 @classmethod
204 def get_appearances(cls, pokemon_id, timediff):
205 '''
206 :param pokemon_id: id of pokemon that we need appearances for
207 :param timediff: limiting period of the selection
208 :return: list of pokemon appearances over a selected period
209 '''
210 if timediff:
211 timediff = datetime.utcnow() - timediff
212 query = (Pokemon
213 .select(Pokemon.latitude, Pokemon.longitude, Pokemon.pokemon_id, fn.Count(Pokemon.spawnpoint_id).alias('count'), Pokemon.spawnpoint_id)
214 .where((Pokemon.pokemon_id == pokemon_id) &
215 (Pokemon.disappear_time > timediff)
216 )
217 .order_by(Pokemon.disappear_time.asc())
218 .group_by(Pokemon.latitude, Pokemon.longitude, Pokemon.pokemon_id, Pokemon.spawnpoint_id)
219 .dicts()
220 )
221
222 return list(query)
223
224 @classmethod
225 def get_appearances_times_by_spawnpoint(cls, pokemon_id, spawnpoint_id, timediff):

Callers 1

raw_dataMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected