diff --git a/stationapi/src/use_case/interactor/query.rs b/stationapi/src/use_case/interactor/query.rs index 05bab586..cab7f1b9 100644 --- a/stationapi/src/use_case/interactor/query.rs +++ b/stationapi/src/use_case/interactor/query.rs @@ -220,11 +220,16 @@ where station.train_type = Some(tt); }; + let mut seen_line_cds = std::collections::HashSet::new(); let mut lines: Vec = lines .iter() - .filter(|&l| l.station_g_cd.unwrap_or(0) == station.station_g_cd) + .filter(|&l| { + l.station_g_cd.unwrap_or(0) == station.station_g_cd + && seen_line_cds.insert(l.line_cd) + }) .cloned() .collect(); + for line in lines.iter_mut() { line.company = companies .iter()