journeys: return effective visibility

This commit is contained in:
Derf Null 2023-06-27 21:50:28 +02:00
parent 8cb0de1b70
commit bb43a2e8e3
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA

View file

@ -514,7 +514,7 @@ sub get {
my @select my @select
= ( = (
qw(journey_id train_type train_line train_no checkin_ts sched_dep_ts real_dep_ts dep_eva dep_ds100 dep_name dep_lat dep_lon checkout_ts sched_arr_ts real_arr_ts arr_eva arr_ds100 arr_name arr_lat arr_lon cancelled edited route messages user_data visibility) qw(journey_id train_type train_line train_no checkin_ts sched_dep_ts real_dep_ts dep_eva dep_ds100 dep_name dep_lat dep_lon checkout_ts sched_arr_ts real_arr_ts arr_eva arr_ds100 arr_name arr_lat arr_lon cancelled edited route messages user_data visibility effective_visibility)
); );
my %where = ( my %where = (
user_id => $uid, user_id => $uid,
@ -605,6 +605,7 @@ sub get {
edited => $entry->{edited}, edited => $entry->{edited},
user_data => $entry->{user_data}, user_data => $entry->{user_data},
visibility => $entry->{visibility}, visibility => $entry->{visibility},
effective_visibility => $entry->{effective_visibility},
}; };
if ( $opt{with_visibility} ) { if ( $opt{with_visibility} ) {
@ -612,6 +613,8 @@ sub get {
= $ref->{visibility} = $ref->{visibility}
? $visibility_itoa{ $ref->{visibility} } ? $visibility_itoa{ $ref->{visibility} }
: 'default'; : 'default';
$ref->{effective_visibility_str}
= $visibility_itoa{ $ref->{effective_visibility} };
} }
if ( $opt{with_polyline} ) { if ( $opt{with_polyline} ) {
@ -720,6 +723,8 @@ sub get_latest {
= $latest_successful->{visibility} = $latest_successful->{visibility}
? $visibility_itoa{ $latest_successful->{visibility} } ? $visibility_itoa{ $latest_successful->{visibility} }
: 'default'; : 'default';
$latest_successful->{effective_visibility_str}
= $visibility_itoa{ $latest_successful->{effective_visibility} };
my $latest = $db->select( my $latest = $db->select(
'journeys_str', 'journeys_str',
@ -737,6 +742,8 @@ sub get_latest {
= $latest->{visibility} = $latest->{visibility}
? $visibility_itoa{ $latest->{visibility} } ? $visibility_itoa{ $latest->{visibility} }
: 'default'; : 'default';
$latest->{effective_visibility_str}
= $visibility_itoa{ $latest->{effective_visibility} };
return ( $latest_successful, $latest ); return ( $latest_successful, $latest );
} }