From 4861f1e571ab328cb157643e741b34ba437ef06a Mon Sep 17 00:00:00 2001 From: David Quintanel Date: Wed, 16 Oct 2024 15:42:19 +0200 Subject: [PATCH] fix review --- source/time_tables/departure_boards.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/source/time_tables/departure_boards.cpp b/source/time_tables/departure_boards.cpp index f3b31eeb15..fadc1458ad 100644 --- a/source/time_tables/departure_boards.cpp +++ b/source/time_tables/departure_boards.cpp @@ -66,16 +66,18 @@ static bool is_terminus_for_all_stop_times(const std::vector& dt_st, +bool update_display_information(bool& vj_found, + const navitia::type::StopTime* st, pbnavitia::PtDisplayInfo* pt_display_information, PbCreator& pb_creator) { - if (!vj_found && dt_st.second != nullptr) { - auto vj = dt_st.second->vehicle_journey; + if (!vj_found && st != nullptr) { + const auto* vj = st->vehicle_journey; pt_display_information->set_trip_short_name(vj->name); pt_display_information->set_headsign(pb_creator.data->pt_data->headsign_handler.get_headsign(vj)); - vj_found = true; + return true; } + + return false; } static void fill_date_times(PbCreator& pb_creator, @@ -148,7 +150,9 @@ static void render(PbCreator& pb_creator, // Now we fill the date_times for (auto dt_st : id_vec.second) { - update_display_information(vj_found, dt_st, pt_display_information, pb_creator); + if (!vj_found) { + vj_found = update_display_information(vj_found, dt_st.second, pt_display_information, pb_creator); + } fill_date_times(pb_creator, schedule, dt_st, calendar_id); } @@ -211,7 +215,9 @@ static void render(PbCreator& pb_creator, // Now we fill the date_times for (auto dt_st : id_vec.second) { - update_display_information(vj_found, dt_st, pt_display_information, pb_creator); + if (!vj_found) { + vj_found = update_display_information(vj_found, dt_st.second, pt_display_information, pb_creator); + } fill_date_times(pb_creator, schedule, dt_st, calendar_id); }