Skip to content

Commit

Permalink
only append unique values to flight links in search
Browse files Browse the repository at this point in the history
  • Loading branch information
its-felix committed Nov 23, 2024
1 parent b0349f9 commit e204074
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ui/src/pages/tools/flight-search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,19 @@ function ResultTable({ title, query }: { title: string, query: UseQueryResult<Qu
query = withAircraftTypeFilter(query, v.aircraft.raw);
query = withAircraftConfigurationVersionFilter(query, v.aircraftConfigurationVersion);
} else {
const uniqueAircraft = new Map<string, {}>();
const uniqueConfiguration = new Map<string, {}>();

for (const child of v.children) {
query = withAircraftTypeFilter(query, child.aircraft.raw);
query = withAircraftConfigurationVersionFilter(query, child.aircraftConfigurationVersion);
if (!uniqueAircraft.has(child.aircraft.raw)) {
uniqueAircraft.set(child.aircraft.raw, {});
query = withAircraftTypeFilter(query, child.aircraft.raw);
}

if (!uniqueConfiguration.has(child.aircraftConfigurationVersion)) {
uniqueConfiguration.set(child.aircraftConfigurationVersion, {});
query = withAircraftConfigurationVersionFilter(query, child.aircraftConfigurationVersion);
}
}
}

Expand Down

0 comments on commit e204074

Please sign in to comment.