diff --git a/lib/Travelynx/Command/work.pm b/lib/Travelynx/Command/work.pm index 9658ff672489545b8747a28fbe34457b3774e318..04ea95b74815e79d75519199a06aec055d773658 100644 --- a/lib/Travelynx/Command/work.pm +++ b/lib/Travelynx/Command/work.pm @@ -136,9 +136,26 @@ sub run { ); if ( $train->arrival_is_cancelled ) { + # depending on the amount of users in transit, some time may + # have passed between fetching $entry from the database and + # now. Ensure that the user is still checked into this train + # before calling checkout to mark the cancellation. + if ( + $db->select( + 'in_transit', + 'count(*) as count', + { + user_id => $uid, + train_no => $train->train_no, + checkout_station_id => $arr + } + )->hash->{count} + ) + { # check out (adds a cancelled journey and resets journey state # to destination selection) - $self->app->checkout( $arr, 0, $uid ); + $self->app->checkout( $arr, 0, $uid ); + } } else { $self->app->add_route_timestamps( $uid, $train, 0 ); diff --git a/templates/_checked_in.html.ep b/templates/_checked_in.html.ep index 4edb1a64e3d44ab4a61f1584efa8c854728a26be..e81de605c707717b81a20b540cde4c72f65c94f9 100644 --- a/templates/_checked_in.html.ep +++ b/templates/_checked_in.html.ep @@ -165,9 +165,10 @@ % } % if ($journey->{extra_data}{cancelled_destination}) {

- Der Halt in <%= $journey->{extra_data}{cancelled_destination} %> - entfällt. Der Zugausfall wurde bereits vermerkt. Bitte wähle ein - neues Reiseziel. + Der Halt an der Zielstation <%= + $journey->{extra_data}{cancelled_destination} %> entfällt. + Die zugehörige Fahrt wurde bereits als ausgefallen eingetragen. + Bitte wähle ein neues Reiseziel.

% } % if (@{$journey->{messages} // []} or @{$journey->{extra_data}{qos_msg} // []}) { diff --git a/templates/_public_status_card.html.ep b/templates/_public_status_card.html.ep index 6979ad774205490091badc0927339e30d5bee0ab..810c4b83bcc02cf3690f7f340d9951303fb7f04a 100644 --- a/templates/_public_status_card.html.ep +++ b/templates/_public_status_card.html.ep @@ -125,6 +125,13 @@ % }

+ % if ($journey->{extra_data}{cancelled_destination}) { +

+ + Der Halt an der Zielstation <%= + $journey->{extra_data}{cancelled_destination} %> entfällt. +

+ % } % if (@{$journey->{messages} // []} > 0 and $journey->{messages}[0]) {