From 531cb95c1773fe459a2ef4c9f2adc8d89e75a62d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 20 May 2019 18:59:28 +0200 Subject: [PATCH] Handle accidental double-checkins --- lib/Travelynx.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index ff75898..d313b25 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -332,8 +332,14 @@ sub startup { my $user = $self->get_user_status; if ( $user->{checked_in} or $user->{cancelled} ) { - # If a user is already checked in, we assume that they forgot to - # check out and do it for them. + if ( $user->{train_id} eq $train_id + and $user->{dep_ds100} eq $status->{station_ds100} ) + { + # checking in twice is harmless + return ( $train, undef ); + } + + # Otherwise, someone forgot to check out first $self->checkout( $station, 1 ); }