summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-09-09 10:06:31 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-09-09 10:06:31 +0200
commit8daf885acefcce8cfe27c9a848f77b814d83df7b (patch)
treefae9d29ca6a96e29eb581174bd7192119c477c4a
parent10dc685d3b2983477891d8318056a148a0c2a4db (diff)
indicate whether current journey has realtime data
-rw-r--r--lib/Travelynx/Model/InTransit.pm12
-rw-r--r--templates/_checked_in.html.ep7
-rw-r--r--templates/_public_status_card.html.ep5
3 files changed, 18 insertions, 6 deletions
diff --git a/lib/Travelynx/Model/InTransit.pm b/lib/Travelynx/Model/InTransit.pm
index d06b94e..9899676 100644
--- a/lib/Travelynx/Model/InTransit.pm
+++ b/lib/Travelynx/Model/InTransit.pm
@@ -96,8 +96,7 @@ sub add {
'in_transit',
{
user_id => $uid,
- cancelled => $train->departure_is_cancelled
- ? 1
+ cancelled => $train->departure_is_cancelled ? 1
: 0,
checkin_station_id => $checkin_station_id,
checkin_time => DateTime->now( time_zone => 'Europe/Berlin' ),
@@ -111,7 +110,13 @@ sub add {
route => $json->encode($route),
messages => $json->encode(
[ 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},
real_departure => $stop->{rt_dep} // $stop->{sched_dep},
route => $json->encode( [@route] ),
+ data => JSON->new->encode( { rt => $stop->{rt_dep} ? 1 : 0 } ),
}
);
}
diff --git a/templates/_checked_in.html.ep b/templates/_checked_in.html.ep
index e5e0baf..f3ecda4 100644
--- a/templates/_checked_in.html.ep
+++ b/templates/_checked_in.html.ep
@@ -2,7 +2,7 @@
<div class="autorefresh">
<div class="card">
<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}) {
<span class="card-title center-align">Ziel wählen</span>
% }
@@ -180,9 +180,12 @@
Bitte wähle ein neues Reiseziel.
</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;">
<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} // []}) {
% 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>
diff --git a/templates/_public_status_card.html.ep b/templates/_public_status_card.html.ep
index f031e15..055e15a 100644
--- a/templates/_public_status_card.html.ep
+++ b/templates/_public_status_card.html.ep
@@ -2,7 +2,7 @@
% if ($journey->{checked_in}) {
<div class="card">
<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">
% if (stash('from_profile')) {
Unterwegs mit <%= include '_format_train', journey => $journey %>
@@ -14,6 +14,9 @@
<a href="/p/<%= $name %>"><%= $name %></a> ist unterwegs
% }
<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>
% if ($privacy->{comments_visible} and $journey->{comment}) {
<p>„<%= $journey->{comment} %>“</p>