This commit is contained in:
Daniel Friesel 2018-10-27 07:32:54 +02:00
parent ddbe902384
commit 048a5c1fd5

View file

@ -307,7 +307,7 @@ helper 'checkout' => sub {
} }
my ($train) my ($train)
= first { $_->train_id eq $train_id } @{ $status->{results} }; = first { $_->train_id eq $train_id } @{ $status->{results} };
if ( not defined $train ) { if ( not defined $train ) {
if ($force) { if ($force) {
my $success = $self->app->checkout_query->execute( my $success = $self->app->checkout_query->execute(
@ -317,8 +317,8 @@ helper 'checkout' => sub {
name => $status->{station_name} name => $status->{station_name}
), ),
DateTime->now( time_zone => 'Europe/Berlin' )->epoch, DateTime->now( time_zone => 'Europe/Berlin' )->epoch,
undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef,
undef, undef, undef undef, undef
); );
if ( defined $success ) { if ( defined $success ) {
return; return;
@ -348,7 +348,7 @@ helper 'checkout' => sub {
join( '|', $train->route ), join( '|', $train->route ),
join( '|', join( '|',
map { ( $_->[0] ? $_->[0]->epoch : q{} ) . ':' . $_->[1] } map { ( $_->[0] ? $_->[0]->epoch : q{} ) . ':' . $_->[1] }
$train->messages ) $train->messages )
); );
if ( defined $success ) { if ( defined $success ) {
return; return;
@ -484,7 +484,9 @@ helper 'get_user_travels' => sub {
} }
); );
} }
elsif ( $action == $action_type{checkin} and $prev_action == $action_type{checkout} ) { elsif ( $action == $action_type{checkin}
and $prev_action == $action_type{checkout} )
{
my $ref = $travels[-1]; my $ref = $travels[-1];
$ref->{from_name} = $name; $ref->{from_name} = $name;
$ref->{completed} = 1; $ref->{completed} = 1;
@ -704,8 +706,9 @@ get '/*station' => sub {
my @results = grep { $_->departure } @{ $status->{results} }; my @results = grep { $_->departure } @{ $status->{results} };
@results = map { $_->[0] } @results = map { $_->[0] }
sort { $b->[1] <=> $a->[1] } sort { $b->[1] <=> $a->[1] }
map { [$_, $_->sched_departure->epoch // $_->departure->epoch] } @results; map { [ $_, $_->sched_departure->epoch // $_->departure->epoch ] }
@results;
$self->render( $self->render(
'departures', 'departures',