avoid stale data when marking cancelled arrivals
This commit is contained in:
parent
a830acc698
commit
6cbbc2b16f
3 changed files with 29 additions and 4 deletions
|
@ -136,10 +136,27 @@ 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 );
|
||||
}
|
||||
}
|
||||
else {
|
||||
$self->app->add_route_timestamps( $uid, $train, 0 );
|
||||
}
|
||||
|
|
|
@ -165,9 +165,10 @@
|
|||
% }
|
||||
% if ($journey->{extra_data}{cancelled_destination}) {
|
||||
<p style="margin-bottom: 2ex;">
|
||||
Der Halt in <b><%= $journey->{extra_data}{cancelled_destination} %></b>
|
||||
entfällt. Der Zugausfall wurde bereits vermerkt. Bitte wähle ein
|
||||
neues Reiseziel.
|
||||
Der Halt an der Zielstation <b><%=
|
||||
$journey->{extra_data}{cancelled_destination} %></b> entfällt.
|
||||
Die zugehörige Fahrt wurde bereits als ausgefallen eingetragen.
|
||||
Bitte wähle ein neues Reiseziel.
|
||||
</p>
|
||||
% }
|
||||
% if (@{$journey->{messages} // []} or @{$journey->{extra_data}{qos_msg} // []}) {
|
||||
|
|
|
@ -125,6 +125,13 @@
|
|||
% }
|
||||
</div>
|
||||
</p>
|
||||
% if ($journey->{extra_data}{cancelled_destination}) {
|
||||
<p style="margin-bottom: 2ex;">
|
||||
<i class="material-icons tiny" aria-hidden="true">error</i>
|
||||
Der Halt an der Zielstation <b><%=
|
||||
$journey->{extra_data}{cancelled_destination} %></b> entfällt.
|
||||
</p>
|
||||
% }
|
||||
% if (@{$journey->{messages} // []} > 0 and $journey->{messages}[0]) {
|
||||
<p style="margin-bottom: 2ex;">
|
||||
<ul>
|
||||
|
|
Loading…
Reference in a new issue