From d9d3aac79200ca7d896d753c897e1651517ecf36 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 19 May 2019 10:32:57 +0200 Subject: allow checkin from connections view --- lib/Travelynx.pm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/Travelynx.pm') diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index 9e00d3f..ff75898 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -175,6 +175,12 @@ sub startup { } ); + $self->helper( + 'now' => sub { + return DateTime->now( time_zone => 'Europe/Berlin' ); + } + ); + $self->helper( 'numify_skipped_stations' => sub { my ( $self, $count ) = @_; @@ -1489,7 +1495,7 @@ sub startup { my $uid = $opt{uid} // $self->current_user->{id}; my $threshold = $opt{threshold} // DateTime->now( time_zone => 'Europe/Berlin' ) - ->subtract( weeks => 60 ); + ->subtract( weeks => 6 ); my $db = $opt{db} // $self->pg->db; my $journey = $db->select( 'in_transit', ['checkout_station_id'], @@ -1504,7 +1510,7 @@ sub startup { }, { limit => 1, - order_by => { -desc => 'real_dep_ts' } + order_by => { -desc => 'real_departure' } } )->hash; } @@ -1547,11 +1553,14 @@ sub startup { } my @destinations = $self->get_connection_targets(%opt); - my $stationboard - = $self->get_departures( $status->{arr_ds100}, 0, 60 ); - @destinations = grep { $_ ne $status->{dep_name} } @destinations; + if ( not @destinations ) { + return; + } + + my $stationboard + = $self->get_departures( $status->{arr_ds100}, 0, 60 ); if ( $stationboard->{errstr} ) { return; } -- cgit v1.2.3