Unverified Commit 30205bce authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Remove connection suggestions when changing a checkin's destination

parent af1ab5a1
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -1461,16 +1461,25 @@ sub startup {
						arrival_eva => $new_checkout_station_id
					);

					# If in_transit already contains arrival data for another estimated
					# destination, we must invalidate it.
					if ( defined $journey->{checkout_station_id}
						and $journey->{checkout_station_id}
						!= $new_checkout_station_id )
					{
						# If in_transit already contains arrival data for another estimated
						# destination, we must invalidate it.
						$self->in_transit->unset_arrival_data(
							uid => $uid,
							db  => $db
						);

						# The same applies to suggestions
						$self->in_transit->update_data(
							uid  => $uid,
							db   => $db,
							data => {
								connection_suggestions_iris => [],
							},
						);
					}

					# Note that a train may pass the same station several times.
@@ -1799,6 +1808,17 @@ sub startup {
						cancelled_destination => $found->[0],
					);
				}
				else {
					# remove connection suggestions that may have been saved for a different target station
					$self->in_transit->update_data(
						uid  => $uid,
						db   => $db,
						data => {
							connection_suggestions_dbris => [],
							connection_suggestions_efa   => [],
						},
					);
				}

				if ($tx) {
					$tx->commit;