Show departures of all linked stations
Not well-tested yet, deployment will have to wait a bit. Issue #15
This commit is contained in:
parent
b08b0fb921
commit
b12b5a821b
4 changed files with 15 additions and 13 deletions
|
@ -218,10 +218,11 @@ sub startup {
|
||||||
|
|
||||||
$self->helper(
|
$self->helper(
|
||||||
'get_departures' => sub {
|
'get_departures' => sub {
|
||||||
my ( $self, $station, $lookbehind, $lookahead ) = @_;
|
my ( $self, $station, $lookbehind, $lookahead, $with_related ) = @_;
|
||||||
|
|
||||||
$lookbehind //= 180;
|
$lookbehind //= 180;
|
||||||
$lookahead //= 30;
|
$lookahead //= 30;
|
||||||
|
$with_related //= 0;
|
||||||
|
|
||||||
my @station_matches
|
my @station_matches
|
||||||
= Travel::Status::DE::IRIS::Stations::get_station($station);
|
= Travel::Status::DE::IRIS::Stations::get_station($station);
|
||||||
|
@ -240,6 +241,7 @@ sub startup {
|
||||||
timeout => 10,
|
timeout => 10,
|
||||||
agent => 'travelynx/' . $self->app->config->{version},
|
agent => 'travelynx/' . $self->app->config->{version},
|
||||||
},
|
},
|
||||||
|
with_related => $with_related,
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
results => [ $status->results ],
|
results => [ $status->results ],
|
||||||
|
@ -348,7 +350,7 @@ sub startup {
|
||||||
'checkin' => sub {
|
'checkin' => sub {
|
||||||
my ( $self, $station, $train_id ) = @_;
|
my ( $self, $station, $train_id ) = @_;
|
||||||
|
|
||||||
my $status = $self->get_departures( $station, 140, 40 );
|
my $status = $self->get_departures( $station, 140, 40, 0 );
|
||||||
if ( $status->{errstr} ) {
|
if ( $status->{errstr} ) {
|
||||||
return ( undef, $status->{errstr} );
|
return ( undef, $status->{errstr} );
|
||||||
}
|
}
|
||||||
|
@ -532,7 +534,7 @@ sub startup {
|
||||||
my ( $self, $station, $force, $uid ) = @_;
|
my ( $self, $station, $force, $uid ) = @_;
|
||||||
|
|
||||||
my $db = $self->pg->db;
|
my $db = $self->pg->db;
|
||||||
my $status = $self->get_departures( $station, 120, 120 );
|
my $status = $self->get_departures( $station, 120, 120, 0 );
|
||||||
$uid //= $self->current_user->{id};
|
$uid //= $self->current_user->{id};
|
||||||
my $user = $self->get_user_status($uid);
|
my $user = $self->get_user_status($uid);
|
||||||
my $train_id = $user->{train_id};
|
my $train_id = $user->{train_id};
|
||||||
|
@ -2060,7 +2062,7 @@ sub startup {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $stationboard = $self->get_departures( $ds100, 0, 40 );
|
my $stationboard = $self->get_departures( $ds100, 0, 40, 1 );
|
||||||
if ( $stationboard->{errstr} ) {
|
if ( $stationboard->{errstr} ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,7 +338,7 @@ sub station {
|
||||||
my $station = $self->stash('station');
|
my $station = $self->stash('station');
|
||||||
my $train = $self->param('train');
|
my $train = $self->param('train');
|
||||||
|
|
||||||
my $status = $self->get_departures( $station, 120, 30 );
|
my $status = $self->get_departures( $station, 120, 30, 1 );
|
||||||
|
|
||||||
if ( $status->{errstr} ) {
|
if ( $status->{errstr} ) {
|
||||||
$self->render(
|
$self->render(
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
% if ($checkin_from) {
|
% if ($checkin_from) {
|
||||||
<a class="action-checkin" data-station="<%= $checkin_from %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>"><%= $train->line %></a>
|
<a class="action-checkin" data-station="<%= $train->station_uic %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>"><%= $train->line %></a>
|
||||||
% }
|
% }
|
||||||
% else {
|
% else {
|
||||||
%= $train->line
|
%= $train->line
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
% if ($checkin_from) {
|
% if ($checkin_from) {
|
||||||
<a class="action-checkin" data-station="<%= $checkin_from %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>"><%= $via %></a>
|
<a class="action-checkin" data-station="<%= $train->station_uic %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>"><%= $via %></a>
|
||||||
% }
|
% }
|
||||||
% else {
|
% else {
|
||||||
%= $via
|
%= $via
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td class="<%= $td_class %>">
|
<td class="<%= $td_class %>">
|
||||||
% if ($checkin_from) {
|
% if ($checkin_from) {
|
||||||
<a class="<%= $link_class %>" data-station="<%= $checkin_from %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>"><%= $train->line %></a>
|
<a class="<%= $link_class %>" data-station="<%= $train->station_uic %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>"><%= $train->line %></a>
|
||||||
% }
|
% }
|
||||||
% else {
|
% else {
|
||||||
%= $train->line
|
%= $train->line
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="<%= $td_class %>">
|
<td class="<%= $td_class %>">
|
||||||
% if ($checkin_from) {
|
% if ($checkin_from) {
|
||||||
<a class="<%= $link_class %>" data-station="<%= $checkin_from %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>"><%= $via %></a>
|
<a class="<%= $link_class %>" data-station="<%= $train->station_uic %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>"><%= $via %></a>
|
||||||
% }
|
% }
|
||||||
% else {
|
% else {
|
||||||
%= $via
|
%= $via
|
||||||
|
|
|
@ -64,12 +64,12 @@
|
||||||
% }
|
% }
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a class="<%= $link_class %>" data-station="<%= $ds100 %>" data-train="<%= $result->train_id %>">
|
<a class="<%= $link_class %>" data-station="<%= $result->station_uic %>" data-train="<%= $result->train_id %>">
|
||||||
<%= $result->line %>
|
<%= $result->line %>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="<%= $td_class %>">
|
<td class="<%= $td_class %>">
|
||||||
<a class="<%= $link_class %>" data-station="<%= $ds100 %>" data-train="<%= $result->train_id %>">
|
<a class="<%= $link_class %>" data-station="<%= $result->station_uic %>" data-train="<%= $result->train_id %>">
|
||||||
<%= $result->destination %>
|
<%= $result->destination %>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in a new issue