summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller/Traveling.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-05-19 10:32:57 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-05-19 10:32:57 +0200
commitd9d3aac79200ca7d896d753c897e1651517ecf36 (patch)
tree87194b7a8b67b7b09bd2dc357e5239099dd60430 /lib/Travelynx/Controller/Traveling.pm
parent7960114f71720f2c2fa86e74be4b80812edaef36 (diff)
allow checkin from connections view
Diffstat (limited to 'lib/Travelynx/Controller/Traveling.pm')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 3d2bb0c..4e4b069 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -145,6 +145,7 @@ sub log_action {
my ( $train, $error )
= $self->checkin( $params->{station}, $params->{train} );
+ my $destination = $params->{dest};
if ($error) {
$self->render(
@@ -154,7 +155,7 @@ sub log_action {
},
);
}
- else {
+ elsif ( not $destination ) {
$self->render(
json => {
success => 1,
@@ -162,6 +163,19 @@ sub log_action {
},
);
}
+ else {
+ # Silently ignore errors -- if they are permanent, the user will see
+ # them when selecting the destination manually.
+ my ( $still_checked_in, undef )
+ = $self->checkout( $destination, 0 );
+ my $station_link = '/s/' . $destination;
+ $self->render(
+ json => {
+ success => 1,
+ redirect_to => $still_checked_in ? '/' : $station_link,
+ },
+ );
+ }
}
elsif ( $params->{action} eq 'checkout' ) {
my ( $still_checked_in, $error )