diff --git a/app/Http/Controllers/Backend/Transport/TrainCheckinController.php b/app/Http/Controllers/Backend/Transport/TrainCheckinController.php index ade26cab0..ae5b8474d 100644 --- a/app/Http/Controllers/Backend/Transport/TrainCheckinController.php +++ b/app/Http/Controllers/Backend/Transport/TrainCheckinController.php @@ -309,7 +309,7 @@ public static function refreshDistanceAndPoints(Status $status, bool $resetPolyl public static function calculateCheckinDuration(Checkin $checkin, bool $update = true): int { $departure = $checkin->manual_departure ?? $checkin->originStopover->departure ?? $checkin->departure; $arrival = $checkin->manual_arrival ?? $checkin->destinationStopover->arrival ?? $checkin->arrival; - $duration = $arrival->diffInMinutes($departure); + $duration = $departure->diffInMinutes($arrival); //don't use eloquent here, because it would trigger the observer (and this function) again if ($update) { DB::table('train_checkins')->where('id', $checkin->id)->update(['duration' => $duration]);