summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travelynx/Controller')
-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 )