Skip to content

Commit

Permalink
Find planets is now fetched by system id (minmatarfleet#783)
Browse files Browse the repository at this point in the history
  • Loading branch information
beautifulmim authored Oct 3, 2024
1 parent d1403c9 commit 8297c95
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions frontend/app/src/helpers/sde/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
)
);

Expand Down
6 changes: 3 additions & 3 deletions frontend/app/src/pages/intel/moons/[system_name].astro
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = []
Expand All @@ -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`))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8297c95

Please sign in to comment.