Commit 6cbbc2b1 authored by Daniel Friesel's avatar Daniel Friesel
Browse files

avoid stale data when marking cancelled arrivals

parent a830acc6
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -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 );
				}
+4 −3
Original line number Diff line number Diff line
@@ -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} // []}) {
+7 −0
Original line number Diff line number Diff line
@@ -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>