Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Channel Type pids #4311

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion source/chaos-proto
Submodule chaos-proto updated 1 files
+4 −0 chaos.proto
4 changes: 3 additions & 1 deletion source/jormungandr/tests/disruptions_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
2 changes: 2 additions & 0 deletions source/kraken/fill_disruption_from_database.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 3 additions & 0 deletions source/kraken/make_disruption_from_chaos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ static std::set<nt::disruption::ChannelType> 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"),
Expand Down
2 changes: 1 addition & 1 deletion source/navitia-proto
Submodule navitia-proto updated 1 files
+1 −0 type.proto
2 changes: 1 addition & 1 deletion source/routing/tests/routing_api_test_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
16 changes: 15 additions & 1 deletion source/type/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
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) {
Expand Down Expand Up @@ -149,6 +161,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");
}
Expand Down
3 changes: 3 additions & 0 deletions source/type/pb_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down
Loading