Unverified Commit 9b6b310e authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Use the correct stop instance when checking in to ring lines

parent 481c49a3
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -441,6 +441,7 @@ sub startup {

			my $station  = $opt{station};
			my $train_id = $opt{train_id};
			my $ts       = $opt{ts};
			my $uid      = $opt{uid} // $self->current_user->{id};
			my $db       = $opt{db}  // $self->pg->db;
			my $hafas;
@@ -534,6 +535,7 @@ sub startup {

			my $station  = $opt{station};
			my $train_id = $opt{train_id};
			my $ts       = $opt{ts};
			my $uid      = $opt{uid} // $self->current_user->{id};
			my $db       = $opt{db}  // $self->pg->db;
			my $hafas;
@@ -553,9 +555,15 @@ sub startup {
							or $stop->loc->eva == $station )
						{
							$found = $stop;

							# Lines may serve the same stop several times.
							# Keep looking until the scheduled departure
							# matches the one passed while checking in.
							if ( $ts and $stop->sched_dep->epoch == $ts ) {
								last;
							}
						}
					}
					if ( not $found ) {
						$promise->reject(
"Did not find stop '$station' within journey '$train_id'"
+4 −2
Original line number Diff line number Diff line
@@ -650,7 +650,8 @@ sub travel_action {
				return $self->checkin_p(
					hafas    => $params->{hafas},
					station  => $params->{station},
					train_id => $params->{train}
					train_id => $params->{train},
					ts       => $params->{ts},
				);
			}
		)->then(
@@ -789,7 +790,8 @@ sub travel_action {
		$self->checkin_p(
			hafas    => $params->{hafas},
			station  => $params->{station},
			train_id => $params->{train}
			train_id => $params->{train},
			ts       => $params->{ts},
		)->then(
			sub {
				$self->render(