diff --git a/include/motis/tag_lookup.h b/include/motis/tag_lookup.h index 0be60a44d..eb0bb0dab 100644 --- a/include/motis/tag_lookup.h +++ b/include/motis/tag_lookup.h @@ -18,7 +18,9 @@ struct tag_lookup { nigiri::source_idx_t get_src(std::string_view tag) const; std::string_view get_tag(nigiri::source_idx_t) const; std::string id(nigiri::timetable const&, nigiri::location_idx_t) const; - std::string id(nigiri::timetable const&, nigiri::rt::run_stop) const; + std::string id(nigiri::timetable const&, + nigiri::rt::run_stop, + nigiri::event_type) const; nigiri::location_idx_t get_location(nigiri::timetable const&, std::string_view) const; std::pair get_trip( diff --git a/src/endpoints/stop_times.cc b/src/endpoints/stop_times.cc index 366f6d46f..138a08c30 100644 --- a/src/endpoints/stop_times.cc +++ b/src/endpoints/stop_times.cc @@ -356,7 +356,7 @@ api::stoptimes_response stop_times::operator()( .routeColor_ = to_str(s.get_route_color(ev_type).color_), .routeTextColor_ = to_str(s.get_route_color(ev_type).text_color_), - .tripId_ = tags_.id(tt_, s), + .tripId_ = tags_.id(tt_, s, ev_type), .routeShortName_ = std::string{s.trip_display_name(ev_type)}, .source_ = fmt::format("{}", fmt::streamed(fr.dbg()))}; }), diff --git a/src/journey_to_response.cc b/src/journey_to_response.cc index 989a6b8a3..821d81cc4 100644 --- a/src/journey_to_response.cc +++ b/src/journey_to_response.cc @@ -123,7 +123,7 @@ api::Itinerary journey_to_response(osr::ways const* w, .agencyName_ = {std::string{agency.long_name_}}, .agencyUrl_ = {std::string{agency.url_}}, .agencyId_ = {std::string{agency.short_name_}}, - .tripId_ = tags.id(tt, enter_stop), + .tripId_ = tags.id(tt, enter_stop, n::event_type::kDep), .routeShortName_ = {std::string{ enter_stop.trip_display_name()}}, .source_ = fmt::to_string(fr.dbg())}); diff --git a/src/railviz.cc b/src/railviz.cc index dea204642..ef4ff55b9 100644 --- a/src/railviz.cc +++ b/src/railviz.cc @@ -370,7 +370,7 @@ api::trips_response get_trains(tag_lookup const& tags, [&](auto&& p) { enc.push(p); }); return {.trips_ = {api::TripInfo{ - .tripId_ = tags.id(tt, from), + .tripId_ = tags.id(tt, from, n::event_type::kDep), .routeShortName_ = std::string{from.trip_display_name(n::event_type::kDep)}}}, .routeColor_ = diff --git a/src/tag_lookup.cc b/src/tag_lookup.cc index 01d62039e..5743bb91c 100644 --- a/src/tag_lookup.cc +++ b/src/tag_lookup.cc @@ -49,10 +49,11 @@ std::string tag_lookup::id(nigiri::timetable const& tt, } std::string tag_lookup::id(nigiri::timetable const& tt, - n::rt::run_stop s) const { + n::rt::run_stop s, + n::event_type const ev_type) const { if (s.fr_->is_scheduled()) { // trip id - auto const t = s.get_trip_idx(n::event_type::kDep); + auto const t = s.get_trip_idx(ev_type); auto const id_idx = tt.trip_ids_[t].front(); auto const id = tt.trip_id_strings_[id_idx].view(); auto const src = tt.trip_id_src_[id_idx];