Show arrival/departure platform in journey card
This commit is contained in:
parent
b4676c11fb
commit
e68043b8fb
5 changed files with 79 additions and 2 deletions
|
@ -345,6 +345,7 @@ sub startup {
|
||||||
),
|
),
|
||||||
checkin_time =>
|
checkin_time =>
|
||||||
DateTime->now( time_zone => 'Europe/Berlin' ),
|
DateTime->now( time_zone => 'Europe/Berlin' ),
|
||||||
|
dep_platform => $train->platform,
|
||||||
train_type => $train->type,
|
train_type => $train->type,
|
||||||
train_line => $train->line_no,
|
train_line => $train->line_no,
|
||||||
train_no => $train->train_no,
|
train_no => $train->train_no,
|
||||||
|
@ -526,6 +527,7 @@ sub startup {
|
||||||
'in_transit',
|
'in_transit',
|
||||||
{
|
{
|
||||||
checkout_time => undef,
|
checkout_time => undef,
|
||||||
|
arr_platform => undef,
|
||||||
sched_arrival => undef,
|
sched_arrival => undef,
|
||||||
real_arrival => undef,
|
real_arrival => undef,
|
||||||
},
|
},
|
||||||
|
@ -549,6 +551,7 @@ sub startup {
|
||||||
'in_transit',
|
'in_transit',
|
||||||
{
|
{
|
||||||
checkout_time => $now,
|
checkout_time => $now,
|
||||||
|
arr_platform => $train->platform,
|
||||||
sched_arrival => $train->sched_arrival,
|
sched_arrival => $train->sched_arrival,
|
||||||
real_arrival => $train->arrival,
|
real_arrival => $train->arrival,
|
||||||
cancelled => $train->arrival_is_cancelled ? 1 : 0,
|
cancelled => $train->arrival_is_cancelled ? 1 : 0,
|
||||||
|
@ -1650,10 +1653,12 @@ sub startup {
|
||||||
real_departure => epoch_to_dt( $in_transit->{real_dep_ts} ),
|
real_departure => epoch_to_dt( $in_transit->{real_dep_ts} ),
|
||||||
dep_ds100 => $in_transit->{dep_ds100},
|
dep_ds100 => $in_transit->{dep_ds100},
|
||||||
dep_name => $in_transit->{dep_name},
|
dep_name => $in_transit->{dep_name},
|
||||||
|
dep_platform => $in_transit->{dep_platform},
|
||||||
sched_arrival => epoch_to_dt( $in_transit->{sched_arr_ts} ),
|
sched_arrival => epoch_to_dt( $in_transit->{sched_arr_ts} ),
|
||||||
real_arrival => epoch_to_dt( $in_transit->{real_arr_ts} ),
|
real_arrival => epoch_to_dt( $in_transit->{real_arr_ts} ),
|
||||||
arr_ds100 => $in_transit->{arr_ds100},
|
arr_ds100 => $in_transit->{arr_ds100},
|
||||||
arr_name => $in_transit->{arr_name},
|
arr_name => $in_transit->{arr_name},
|
||||||
|
arr_platform => $in_transit->{arr_platform},
|
||||||
route_after => \@route_after,
|
route_after => \@route_after,
|
||||||
messages => $in_transit->{messages}
|
messages => $in_transit->{messages}
|
||||||
? [ split( qr{[|]}, $in_transit->{messages} ) ]
|
? [ split( qr{[|]}, $in_transit->{messages} ) ]
|
||||||
|
@ -1725,10 +1730,12 @@ sub startup {
|
||||||
real_departure => epoch_to_dt( $latest->{real_dep_ts} ),
|
real_departure => epoch_to_dt( $latest->{real_dep_ts} ),
|
||||||
dep_ds100 => $latest->{dep_ds100},
|
dep_ds100 => $latest->{dep_ds100},
|
||||||
dep_name => $latest->{dep_name},
|
dep_name => $latest->{dep_name},
|
||||||
|
dep_platform => $latest->{dep_platform},
|
||||||
sched_arrival => epoch_to_dt( $latest->{sched_arr_ts} ),
|
sched_arrival => epoch_to_dt( $latest->{sched_arr_ts} ),
|
||||||
real_arrival => epoch_to_dt( $latest->{real_arr_ts} ),
|
real_arrival => epoch_to_dt( $latest->{real_arr_ts} ),
|
||||||
arr_ds100 => $latest->{arr_ds100},
|
arr_ds100 => $latest->{arr_ds100},
|
||||||
arr_name => $latest->{arr_name},
|
arr_name => $latest->{arr_name},
|
||||||
|
arr_platform => $latest->{arr_platform},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -481,6 +481,60 @@ my @migrations = (
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# v11 -> v12
|
||||||
|
sub {
|
||||||
|
my ($db) = @_;
|
||||||
|
$db->query(
|
||||||
|
qq{
|
||||||
|
alter table journeys
|
||||||
|
add column dep_platform varchar(16),
|
||||||
|
add column arr_platform varchar(16);
|
||||||
|
alter table in_transit
|
||||||
|
add column dep_platform varchar(16),
|
||||||
|
add column arr_platform varchar(16);
|
||||||
|
create or replace view journeys_str as select
|
||||||
|
journeys.id as journey_id, user_id,
|
||||||
|
train_type, train_line, train_no, train_id,
|
||||||
|
extract(epoch from checkin_time) as checkin_ts,
|
||||||
|
extract(epoch from sched_departure) as sched_dep_ts,
|
||||||
|
extract(epoch from real_departure) as real_dep_ts,
|
||||||
|
dep_stations.ds100 as dep_ds100,
|
||||||
|
dep_stations.name as dep_name,
|
||||||
|
extract(epoch from checkout_time) as checkout_ts,
|
||||||
|
extract(epoch from sched_arrival) as sched_arr_ts,
|
||||||
|
extract(epoch from real_arrival) as real_arr_ts,
|
||||||
|
arr_stations.ds100 as arr_ds100,
|
||||||
|
arr_stations.name as arr_name,
|
||||||
|
cancelled, edited, route, messages,
|
||||||
|
dep_platform, arr_platform
|
||||||
|
from journeys
|
||||||
|
join stations as dep_stations on dep_stations.id = checkin_station_id
|
||||||
|
join stations as arr_stations on arr_stations.id = checkout_station_id
|
||||||
|
;
|
||||||
|
create or replace view in_transit_str as select
|
||||||
|
user_id,
|
||||||
|
train_type, train_line, train_no, train_id,
|
||||||
|
extract(epoch from checkin_time) as checkin_ts,
|
||||||
|
extract(epoch from sched_departure) as sched_dep_ts,
|
||||||
|
extract(epoch from real_departure) as real_dep_ts,
|
||||||
|
dep_stations.ds100 as dep_ds100,
|
||||||
|
dep_stations.name as dep_name,
|
||||||
|
extract(epoch from checkout_time) as checkout_ts,
|
||||||
|
extract(epoch from sched_arrival) as sched_arr_ts,
|
||||||
|
extract(epoch from real_arrival) as real_arr_ts,
|
||||||
|
arr_stations.ds100 as arr_ds100,
|
||||||
|
arr_stations.name as arr_name,
|
||||||
|
cancelled, route, messages,
|
||||||
|
dep_platform, arr_platform
|
||||||
|
from in_transit
|
||||||
|
join stations as dep_stations on dep_stations.id = checkin_station_id
|
||||||
|
left join stations as arr_stations on arr_stations.id = checkout_station_id
|
||||||
|
;
|
||||||
|
update schema_version set version = 12;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
sub setup_db {
|
sub setup_db {
|
||||||
|
|
|
@ -45,6 +45,7 @@ sub run {
|
||||||
$db->update(
|
$db->update(
|
||||||
'in_transit',
|
'in_transit',
|
||||||
{
|
{
|
||||||
|
dep_platform => $train->platform,
|
||||||
real_departure => $train->departure,
|
real_departure => $train->departure,
|
||||||
route => join( '|', $train->route ),
|
route => join( '|', $train->route ),
|
||||||
messages => join(
|
messages => join(
|
||||||
|
@ -95,6 +96,7 @@ sub run {
|
||||||
$db->update(
|
$db->update(
|
||||||
'in_transit',
|
'in_transit',
|
||||||
{
|
{
|
||||||
|
arr_platform => $train->platform,
|
||||||
sched_arrival => $train->sched_arrival,
|
sched_arrival => $train->sched_arrival,
|
||||||
real_arrival => $train->arrival,
|
real_arrival => $train->arrival,
|
||||||
route => join( '|', $train->route ),
|
route => join( '|', $train->route ),
|
||||||
|
|
|
@ -8,12 +8,15 @@
|
||||||
data-arrival="<%= $journey->{real_arrival}->epoch %>">
|
data-arrival="<%= $journey->{real_arrival}->epoch %>">
|
||||||
% if ($journey->{departure_countdown} > 120) {
|
% if ($journey->{departure_countdown} > 120) {
|
||||||
Abfahrt in <%= sprintf('%.f', $journey->{departure_countdown} / 60) %> Minuten
|
Abfahrt in <%= sprintf('%.f', $journey->{departure_countdown} / 60) %> Minuten
|
||||||
|
<br/>von Gleis <%= $journey->{dep_platform} %>
|
||||||
% }
|
% }
|
||||||
% elsif ($journey->{departure_countdown} > 60) {
|
% elsif ($journey->{departure_countdown} > 60) {
|
||||||
Abfahrt in einer Minute
|
Abfahrt in einer Minute
|
||||||
|
<br/>von Gleis <%= $journey->{dep_platform} %>
|
||||||
% }
|
% }
|
||||||
% elsif ($journey->{departure_countdown} > 0) {
|
% elsif ($journey->{departure_countdown} > 0) {
|
||||||
Abfahrt in weniger als einer Minute
|
Abfahrt in weniger als einer Minute
|
||||||
|
<br/>von Gleis <%= $journey->{dep_platform} %>
|
||||||
% }
|
% }
|
||||||
% elsif (defined $journey->{arrival_countdown}) {
|
% elsif (defined $journey->{arrival_countdown}) {
|
||||||
% if ($journey->{arrival_countdown} > 60) {
|
% if ($journey->{arrival_countdown} > 60) {
|
||||||
|
@ -26,6 +29,9 @@
|
||||||
% else {
|
% else {
|
||||||
Ziel erreicht
|
Ziel erreicht
|
||||||
% }
|
% }
|
||||||
|
% if ($journey->{arrival_countdown} < (60 * 15)) {
|
||||||
|
<br/>auf Gleis <%= $journey->{arr_platform} %>
|
||||||
|
% }
|
||||||
% }
|
% }
|
||||||
% elsif ($journey->{arr_name}) {
|
% elsif ($journey->{arr_name}) {
|
||||||
Ankunft in mehr als zwei Stunden
|
Ankunft in mehr als zwei Stunden
|
||||||
|
@ -75,7 +81,7 @@
|
||||||
<p>
|
<p>
|
||||||
Der automatische Checkout erfolgt in wenigen Minuten. Zum Umsteigen:
|
Der automatische Checkout erfolgt in wenigen Minuten. Zum Umsteigen:
|
||||||
Aktuelle Station erneut in der Liste auswählen. Zum Weiterfahren im
|
Aktuelle Station erneut in der Liste auswählen. Zum Weiterfahren im
|
||||||
selben Zug: Neues Ziel wählen.
|
aktuellen Zug: Neues Ziel wählen.
|
||||||
</p>
|
</p>
|
||||||
% }
|
% }
|
||||||
% elsif ($journey->{arr_name}) {
|
% elsif ($journey->{arr_name}) {
|
||||||
|
|
|
@ -4,7 +4,12 @@
|
||||||
<i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i>
|
<i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i>
|
||||||
<span class="card-title"><%= $name %> ist unterwegs</span>
|
<span class="card-title"><%= $name %> ist unterwegs</span>
|
||||||
<p>
|
<p>
|
||||||
|
% if ($journey->{train_line}) {
|
||||||
|
<div class="center-align"><b><%= $journey->{train_type} %> <%= $journey->{train_line} %></b> <%= $journey->{train_no} %></div>
|
||||||
|
% }
|
||||||
|
% else {
|
||||||
<div class="center-align"><b><%= $journey->{train_type} %> <%= $journey->{train_no} %></b></div>
|
<div class="center-align"><b><%= $journey->{train_type} %> <%= $journey->{train_no} %></b></div>
|
||||||
|
% }
|
||||||
<div class="center-align countdown"
|
<div class="center-align countdown"
|
||||||
data-duration="<%= $journey->{journey_duration} // 0 %>"
|
data-duration="<%= $journey->{journey_duration} // 0 %>"
|
||||||
data-arrival="<%= $journey->{real_arrival}->epoch %>">
|
data-arrival="<%= $journey->{real_arrival}->epoch %>">
|
||||||
|
@ -28,6 +33,9 @@
|
||||||
% else {
|
% else {
|
||||||
Ziel erreicht
|
Ziel erreicht
|
||||||
% }
|
% }
|
||||||
|
% if ($journey->{arrival_countdown} < (60 * 15)) {
|
||||||
|
<br/>auf Gleis <%= $journey->{arr_platform} %>
|
||||||
|
% }
|
||||||
% }
|
% }
|
||||||
% elsif ($journey->{arr_name}) {
|
% elsif ($journey->{arr_name}) {
|
||||||
Ankunft in mehr als zwei Stunden
|
Ankunft in mehr als zwei Stunden
|
||||||
|
|
Loading…
Reference in a new issue