indicate whether current journey has realtime data

This commit is contained in:
Birte Kristina Friesel 2023-09-09 10:06:31 +02:00
parent 10dc685d3b
commit 8daf885ace
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA
3 changed files with 18 additions and 6 deletions

View file

@ -96,8 +96,7 @@ sub add {
'in_transit', 'in_transit',
{ {
user_id => $uid, user_id => $uid,
cancelled => $train->departure_is_cancelled cancelled => $train->departure_is_cancelled ? 1
? 1
: 0, : 0,
checkin_station_id => $checkin_station_id, checkin_station_id => $checkin_station_id,
checkin_time => DateTime->now( time_zone => 'Europe/Berlin' ), checkin_time => DateTime->now( time_zone => 'Europe/Berlin' ),
@ -111,7 +110,13 @@ sub add {
route => $json->encode($route), route => $json->encode($route),
messages => $json->encode( messages => $json->encode(
[ map { [ $_->[0]->epoch, $_->[1] ] } $train->messages ] [ map { [ $_->[0]->epoch, $_->[1] ] } $train->messages ]
) ),
data => JSON->new->encode(
{
rt => $train->departure_has_realtime ? 1
: 0
}
),
} }
); );
} }
@ -152,6 +157,7 @@ sub add {
sched_departure => $stop->{sched_dep}, sched_departure => $stop->{sched_dep},
real_departure => $stop->{rt_dep} // $stop->{sched_dep}, real_departure => $stop->{rt_dep} // $stop->{sched_dep},
route => $json->encode( [@route] ), route => $json->encode( [@route] ),
data => JSON->new->encode( { rt => $stop->{rt_dep} ? 1 : 0 } ),
} }
); );
} }

View file

@ -2,7 +2,7 @@
<div class="autorefresh"> <div class="autorefresh">
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i> <i class="material-icons right sync-failed-marker grey-text" style="display: none;">sync_problem</i>
% if (not $journey->{arr_name}) { % if (not $journey->{arr_name}) {
<span class="card-title center-align">Ziel wählen</span> <span class="card-title center-align">Ziel wählen</span>
% } % }
@ -180,9 +180,12 @@
Bitte wähle ein neues Reiseziel. Bitte wähle ein neues Reiseziel.
</p> </p>
% } % }
% if (@{$journey->{messages} // []} or @{$journey->{extra_data}{qos_msg} // []}) { % if (@{$journey->{messages} // []} or @{$journey->{extra_data}{qos_msg} // []} or not $journey->{extra_data}{rt}) {
<p style="margin-bottom: 2ex;"> <p style="margin-bottom: 2ex;">
<ul> <ul>
% if (not $journey->{extra_data}{rt}) {
<li><i class="material-icons tiny">gps_off</i> Keine Echtzeitdaten vorhanden
% }
% for my $message (reverse @{$journey->{messages} // []}) { % for my $message (reverse @{$journey->{messages} // []}) {
% if ($journey->{sched_departure}->epoch - $message->[0]->epoch < 1800) { % if ($journey->{sched_departure}->epoch - $message->[0]->epoch < 1800) {
<li> <i class="material-icons tiny">warning</i> <%= $message->[0]->strftime('%H:%M') %>: <%= $message->[1] %></li> <li> <i class="material-icons tiny">warning</i> <%= $message->[0]->strftime('%H:%M') %>: <%= $message->[1] %></li>

View file

@ -2,7 +2,7 @@
% if ($journey->{checked_in}) { % if ($journey->{checked_in}) {
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i> <i class="material-icons right sync-failed-marker grey-text" style="display: none;">sync_problem</i>
<span class="card-title"> <span class="card-title">
% if (stash('from_profile')) { % if (stash('from_profile')) {
Unterwegs mit <%= include '_format_train', journey => $journey %> Unterwegs mit <%= include '_format_train', journey => $journey %>
@ -14,6 +14,9 @@
<a href="/p/<%= $name %>"><%= $name %></a> ist unterwegs <a href="/p/<%= $name %>"><%= $name %></a> ist unterwegs
% } % }
<i class="material-icons right"><%= visibility_icon($journey->{effective_visibility_str}) %></i> <i class="material-icons right"><%= visibility_icon($journey->{effective_visibility_str}) %></i>
% if (not $journey->{extra_data}{rt}) {
<i class="material-icons right grey-text">gps_off</i>
% }
</span> </span>
% if ($privacy->{comments_visible} and $journey->{comment}) { % if ($privacy->{comments_visible} and $journey->{comment}) {
<p>„<%= $journey->{comment} %>“</p> <p>„<%= $journey->{comment} %>“</p>