From 8297c95a9a521b373aa586d8d8ac59ee708b253f Mon Sep 17 00:00:00 2001 From: Beautiful Mim <156966699+beautifulmim@users.noreply.github.com> Date: Wed, 2 Oct 2024 22:15:33 -0400 Subject: [PATCH] Find planets is now fetched by system id (#783) --- frontend/app/src/helpers/sde/map.ts | 6 +++--- frontend/app/src/pages/intel/moons/[system_name].astro | 6 +++--- .../src/pages/partials/moon_tracking_system_component.astro | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/app/src/helpers/sde/map.ts b/frontend/app/src/helpers/sde/map.ts index dc2bed73..72571168 100644 --- a/frontend/app/src/helpers/sde/map.ts +++ b/frontend/app/src/helpers/sde/map.ts @@ -155,8 +155,8 @@ export async function find_system_moons_fast(system_name:string) { return q as MoonBasic[] } -export async function find_system_planets(system_name:string) { - console.log(`Requesting: sde_db.find_system_planets(${system_name})`) +export async function find_system_planets(system_id:number) { + console.log(`Requesting: sde_db.find_system_planets(${system_id})`) const SDE_PLANETS_GROUP_ID = 7 @@ -177,7 +177,7 @@ export async function find_system_planets(system_name:string) { .where( and( eq(schema.invUniqueNames.groupId, SDE_PLANETS_GROUP_ID), - like(schema.mapSolarSystems.solarSystemName, `${system_name}%`) + eq(schema.mapSolarSystems.solarSystemId, system_id) ) ); diff --git a/frontend/app/src/pages/intel/moons/[system_name].astro b/frontend/app/src/pages/intel/moons/[system_name].astro index 78f571c5..068de62d 100644 --- a/frontend/app/src/pages/intel/moons/[system_name].astro +++ b/frontend/app/src/pages/intel/moons/[system_name].astro @@ -21,7 +21,7 @@ if (!is_superuser && !user_permissions.includes('moons.view_evemoon')) let system_name = Astro.params.system_name import { fetch_scanned_moons } from '@helpers/fetching/moons' -import { find_system_planets, get_system_id, find_systems_moons, get_system_sun_type_id_by_name } from '@helpers/sde/map' +import { find_system_planets, get_system_id, find_systems_moons, get_system_sun_type_id } from '@helpers/sde/map' import type { PlanetBasic, MoonBasic, MoonUI, PlanetMoonsUI } from '@dtypes/layout_components' let planets:PlanetBasic[] = [] @@ -33,11 +33,11 @@ let sun_type_id:number let fetch_moon_system_data_error:string try { - planets = await find_system_planets(system_name) const system_id = await get_system_id(system_name) + planets = await find_system_planets(system_id) moons = await find_systems_moons([system_id]) scanned_moons = await fetch_scanned_moons(auth_token, system_name) - sun_type_id = await get_system_sun_type_id_by_name(system_name) + sun_type_id = await get_system_sun_type_id(system_id) planet_moons = planets.map(planet => { const planet_moons = moons.filter(moon => moon.name.startsWith(`${planet.name} - Moon`)) diff --git a/frontend/app/src/pages/partials/moon_tracking_system_component.astro b/frontend/app/src/pages/partials/moon_tracking_system_component.astro index 703bd321..d19dbe9c 100644 --- a/frontend/app/src/pages/partials/moon_tracking_system_component.astro +++ b/frontend/app/src/pages/partials/moon_tracking_system_component.astro @@ -32,8 +32,8 @@ let total_scanned:number = 0 let fetch_moon_system_data_error:string try { - planets = await find_system_planets(system_name) const system_id = await get_system_id(system_name) + planets = await find_system_planets(system_id) moons = await find_systems_moons([system_id]) scanned_moons = await fetch_scanned_moons(auth_token, system_name)