Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions stationapi/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2463,17 +2463,17 @@ async fn integrate_gtfs_trip_variations_to_types(
let is_bidirectional = directions.len() > 1;

// Naming rule:
// - 双方向ペア (同じ停留所集合, direction 0/1) → "<A> ⇔ <B>" (両端駅) ※「行」は付けない
// - 循環トリップ (始発 parent == 終点 parent) → "<headsign>(<経由地>経由・循環)"
// (経由地が取れなければ "<headsign> (循環)" にフォールバック)
// - それ以外で始発名と headsign が異なる → "<first_stop> → <headsign>"
// - 始発名と headsign が同じ / どちらか欠落 → headsign があれば "<headsign>"、
// 無ければ "<first_stop>" (始発名は行き先ではないので「行」は付けない)
// - 双方向ペア (同じ停留所集合, direction 0/1) → "<A> ⇔ <B>" (両端駅)
// - 循環トリップ (始発 parent == 終点 parent) → "<headsign>(<経由地>経由・循環)"
// (経由地が取れなければ "<headsign> (循環)" にフォールバック)
// - それ以外で始発名と headsign が異なる → "<first_stop> → <headsign>"
// - 始発名と headsign が同じ / どちらか欠落 → headsign があれば "<headsign>"、
// 無ければ "<first_stop>"
// - すべて欠落 → "shape <shape_id>" でフォールバック
let loop_name = |label: &str| -> String {
match via_for_rep.get(&rep_idx) {
Some(via) => format!("{}({}経由・循環)", label, via),
None => format!("{} (循環)", label),
Some(via) => format!("{}({}経由・循環)", label, via),
None => format!("{} (循環)", label),
}
};
// Roman counterpart: "<label> via <via> (Loop)" / "<label> (Loop)". When the via
Expand Down Expand Up @@ -2507,9 +2507,9 @@ async fn integrate_gtfs_trip_variations_to_types(
(true, _, Some(h)) => loop_name(h),
(true, Some(first), None) => loop_name(first),
(false, Some(first), Some(h)) if first != h => {
format!("{} → {}", first, h)
format!("{} → {}", first, h)
}
(_, _, Some(h)) => format!("{}行", h),
(_, _, Some(h)) => h.to_string(),
(_, Some(first), None) => first.to_string(),
_ => format!("shape {}", v.shape_id),
}
Expand Down
Loading