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

checkin: reduce nesting

parent b5723264
Loading
Loading
Loading
Loading
+40 −44
Original line number Diff line number Diff line
@@ -430,13 +430,12 @@ sub startup {
			if ( $status->{errstr} ) {
				return ( undef, $status->{errstr} );
			}
			else {

			my ($train) = List::Util::first { $_->train_id eq $train_id }
			@{ $status->{results} };
			if ( not defined $train ) {
				return ( undef, "Train ${train_id} not found" );
			}
				else {

			my $user = $self->get_user_status( $uid, $db );
			if ( $user->{checked_in} or $user->{cancelled} ) {
@@ -467,8 +466,7 @@ sub startup {
				);
			};
			if ($@) {
						$self->app->log->error(
							"Checkin($uid): INSERT failed: $@");
				$self->app->log->error("Checkin($uid): INSERT failed: $@");
				return ( undef, 'INSERT failed: ' . $@ );
			}
			if ( not $opt{in_transaction} ) {
@@ -479,8 +477,6 @@ sub startup {
			}
			return ( $train, undef );
		}
			}
		}
	);

	$self->helper(