From dcc3a3ff245908cfe80522ddaacbbb87967e5763 Mon Sep 17 00:00:00 2001 From: krishna Date: Wed, 9 Oct 2024 16:49:28 +0200 Subject: [PATCH 1/2] Use Channel Type pids --- source/chaos-proto | 2 +- source/jormungandr/tests/disruptions_tests.py | 4 +++- source/kraken/fill_disruption_from_database.h | 2 ++ source/kraken/make_disruption_from_chaos.cpp | 3 +++ source/navitia-proto | 2 +- source/routing/tests/routing_api_test_data.h | 2 +- source/type/message.h | 4 +++- source/type/pb_converter.cpp | 3 +++ 8 files changed, 17 insertions(+), 5 deletions(-) diff --git a/source/chaos-proto b/source/chaos-proto index fbf1948102..14cff78e8d 160000 --- a/source/chaos-proto +++ b/source/chaos-proto @@ -1 +1 @@ -Subproject commit fbf19481022fc0384768993615a4303ca65691c1 +Subproject commit 14cff78e8d343a7a407096bdb66624feb710a339 diff --git a/source/jormungandr/tests/disruptions_tests.py b/source/jormungandr/tests/disruptions_tests.py index fb8214ee4c..7e61fb35b8 100644 --- a/source/jormungandr/tests/disruptions_tests.py +++ b/source/jormungandr/tests/disruptions_tests.py @@ -682,7 +682,9 @@ def test_disruption_on_route_and_line(self): channel = get_not_null(message[2], 'channel') assert channel['id'] == 'beacon' assert channel['name'] == 'beacon channel' - assert len(channel['types']) == 3 + assert len(channel['types']) == 4 + assert 'web' in channel['types'] + assert 'pids' in channel['types'] def test_disruption_date_filtering(self): """ diff --git a/source/kraken/fill_disruption_from_database.h b/source/kraken/fill_disruption_from_database.h index b4dc094ca4..bf0cd3c977 100644 --- a/source/kraken/fill_disruption_from_database.h +++ b/source/kraken/fill_disruption_from_database.h @@ -471,6 +471,8 @@ struct DisruptionDatabaseReader { channel->add_types(chaos::Channel_Type_title); } else if (type_ == "beacon") { channel->add_types(chaos::Channel_Type_beacon); + } else if (type_ == "pids") { + channel->add_types(chaos::Channel_Type_pids); } else { channel->add_types(chaos::Channel_Type_unkown_type); } diff --git a/source/kraken/make_disruption_from_chaos.cpp b/source/kraken/make_disruption_from_chaos.cpp index 7515f0e2d1..666f8020c5 100644 --- a/source/kraken/make_disruption_from_chaos.cpp +++ b/source/kraken/make_disruption_from_chaos.cpp @@ -323,6 +323,9 @@ static std::set create_channel_types(const chaos::C case chaos::Channel_Type_beacon: res.insert(nt::disruption::ChannelType::beacon); break; + case chaos::Channel_Type_pids: + res.insert(nt::disruption::ChannelType::pids); + break; default: res.insert(nt::disruption::ChannelType::unknown_type); LOG4CPLUS_WARN(log4cplus::Logger::getInstance("log"), diff --git a/source/navitia-proto b/source/navitia-proto index f66f1609ee..4f9d2ee859 160000 --- a/source/navitia-proto +++ b/source/navitia-proto @@ -1 +1 @@ -Subproject commit f66f1609ee04df1fcee19ae5f120524ff41cd5a1 +Subproject commit 4f9d2ee8596af7c4d28abda52c7b9916a61ee57f diff --git a/source/routing/tests/routing_api_test_data.h b/source/routing/tests/routing_api_test_data.h index f9dfd75e4e..ff3033bfed 100644 --- a/source/routing/tests/routing_api_test_data.h +++ b/source/routing/tests/routing_api_test_data.h @@ -822,7 +822,7 @@ struct routing_api_data { "content type", default_date, default_date, - {ChannelType::web, ChannelType::title, ChannelType::beacon}, + {ChannelType::web, ChannelType::title, ChannelType::beacon, ChannelType::pids}, {}}); disruption_maker.impact() diff --git a/source/type/message.h b/source/type/message.h index 916181fe61..98196be086 100644 --- a/source/type/message.h +++ b/source/type/message.h @@ -69,7 +69,7 @@ enum class Effect { enum class ActiveStatus { past = 0, active = 1, future = 2 }; -enum class ChannelType { web = 0, sms, email, mobile, notification, twitter, facebook, unknown_type, title, beacon }; +enum class ChannelType { web = 0, sms, email, mobile, notification, twitter, facebook, unknown_type, title, beacon, pids }; inline std::string to_string(Effect effect) { switch (effect) { @@ -149,6 +149,8 @@ inline std::string to_string(ChannelType ct) { return "title"; case ChannelType::beacon: return "beacon"; + case ChannelType::pids: + return "pids"; default: throw navitia::exception("unhandled channeltype case"); } diff --git a/source/type/pb_converter.cpp b/source/type/pb_converter.cpp index e8332edf94..5d457a821e 100644 --- a/source/type/pb_converter.cpp +++ b/source/type/pb_converter.cpp @@ -1389,6 +1389,9 @@ void PbCreator::Filler::fill_pb_object(const nd::Impact* impact, pbnavitia::Impa case nd::ChannelType::beacon: pb_channel->add_channel_types(pbnavitia::Channel::beacon); break; + case nd::ChannelType::pids: + pb_channel->add_channel_types(pbnavitia::Channel::pids); + break; } } } From 6a6e7972410765861339c684b4ce9dd2507fc479 Mon Sep 17 00:00:00 2001 From: krishna Date: Wed, 9 Oct 2024 17:17:53 +0200 Subject: [PATCH 2/2] Formatting --- source/type/message.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/type/message.h b/source/type/message.h index 98196be086..908071475a 100644 --- a/source/type/message.h +++ b/source/type/message.h @@ -69,7 +69,19 @@ enum class Effect { enum class ActiveStatus { past = 0, active = 1, future = 2 }; -enum class ChannelType { web = 0, sms, email, mobile, notification, twitter, facebook, unknown_type, title, beacon, pids }; +enum class ChannelType { + web = 0, + sms, + email, + mobile, + notification, + twitter, + facebook, + unknown_type, + title, + beacon, + pids +}; inline std::string to_string(Effect effect) { switch (effect) {