Browse Source

- Cache the game info, the loop doesn't break so it was using a cached game_info

master
Quildra 1 year ago
parent
commit
95f816a6da
  1. 24
      ui/workers/calculate_origin_mark_worker.py

24
ui/workers/calculate_origin_mark_worker.py

@ -118,14 +118,16 @@ class CalculateOriginMarkWorker(QRunnable):
# If there are no encounters for the pokemon form or its evolution line from this generation, # If there are no encounters for the pokemon form or its evolution line from this generation,
# use the mark of the earliest game of the generation is marked as being introducted in. # use the mark of the earliest game of the generation is marked as being introducted in.
if encounters: if encounters:
earliest_game = 100 earliest_game_id = 100
earliest_game = None
for encounter in encounters: for encounter in encounters:
game_info = db.get_game_by_id(encounter["game_id"]) game_info = db.get_game_by_id(encounter["game_id"])
if game_info["id"] <= earliest_game: if game_info["id"] <= earliest_game_id:
earliest_game = game_info["id"] earliest_game_id = game_info["id"]
if earliest_game < 100: earliest_game = game_info
if earliest_game_id < 100:
form_info = db.get_pokemon_details(pfic) form_info = db.get_pokemon_details(pfic)
mark_id = game_info["mark"] mark_id = earliest_game["mark"]
if mark_id == None: if mark_id == None:
print(f"No mark found for {get_display_name(form_info)}") print(f"No mark found for {get_display_name(form_info)}")
pass pass
@ -136,14 +138,16 @@ class CalculateOriginMarkWorker(QRunnable):
event_encounters = db.get_encounters(pfic, "event") event_encounters = db.get_encounters(pfic, "event")
if event_encounters: if event_encounters:
earliest_game = 100 earliest_game_id = 100
earliest_game = None
for encounter in event_encounters: for encounter in event_encounters:
game_info = game_info = db.get_game_by_id(encounter["game_id"]) game_info = game_info = db.get_game_by_id(encounter["game_id"])
if game_info["id"] <= earliest_game: if game_info["id"] <= earliest_game_id:
earliest_game = game_info["id"] earliest_game_id = game_info["id"]
if earliest_game < 100: earliest_game = game_info
if earliest_game_id < 100:
form_info = db.get_pokemon_details(pfic) form_info = db.get_pokemon_details(pfic)
mark_id = game_info["mark"] mark_id = earliest_game["mark"]
if mark_id == None: if mark_id == None:
print(f"No mark found for {get_display_name(form_info)}") print(f"No mark found for {get_display_name(form_info)}")
else: else:

Loading…
Cancel
Save