Add per-condition encounter rates to seed data (#26)
All checks were successful
CI / backend-lint (push) Successful in 9s
CI / actions-lint (push) Successful in 15s
CI / frontend-lint (push) Successful in 20s

Co-authored-by: Julian Tabel <juliantabel.jt@gmail.com>
Co-committed-by: Julian Tabel <juliantabel.jt@gmail.com>
This commit was merged in pull request #26.
This commit is contained in:
2026-02-17 19:38:29 +01:00
committed by TheFurya
parent d0fff248fe
commit 7df56325a8
38 changed files with 36723 additions and 11591 deletions

View File

@@ -69,8 +69,9 @@ async def export_game_routes(
game_encounters = [
enc for enc in route.route_encounters if enc.game_id == game_id
]
return [
{
result = []
for enc in sorted(game_encounters, key=lambda e: -e.encounter_rate):
entry: dict = {
"pokeapi_id": enc.pokemon.pokeapi_id,
"pokemon_name": enc.pokemon.name,
"method": enc.encounter_method,
@@ -78,8 +79,10 @@ async def export_game_routes(
"min_level": enc.min_level,
"max_level": enc.max_level,
}
for enc in sorted(game_encounters, key=lambda e: -e.encounter_rate)
]
if enc.condition:
entry["condition"] = enc.condition
result.append(entry)
return result
def format_route(route: Route) -> dict:
data: dict = {

View File

@@ -213,6 +213,7 @@ async def get_pokemon_encounter_locations(
route_name=enc.route.name,
encounter_method=enc.encounter_method,
encounter_rate=enc.encounter_rate,
condition=enc.condition,
min_level=enc.min_level,
max_level=enc.max_level,
)