Skip to content

Commit

Permalink
Calculate on base of the correct data after update
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrLevin committed Aug 2, 2024
1 parent 08f7764 commit 41c5c2f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/Models/Stopover.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
* @property int $train_station_id
* @property UTCDateTime $arrival_planned
* @property UTCDateTime $arrival_real
* @property UTCDateTime $arrival
* @property string $arrival_platform_planned
* @property string $arrival_platform_real
* @property UTCDateTime $departure_planned
* @property UTCDateTime $departure_real
* @property UTCDateTime $departure
* @property string $departure_platform_planned
* @property string $departure_platform_real
* @property bool $isArrivalDelayed
Expand Down
3 changes: 1 addition & 2 deletions app/Observers/CheckinObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@

class CheckinObserver
{

public function updated(Checkin $checkin): void {
if ($checkin->isDirty(['origin', 'destination', 'departure', 'arrival', 'manual_departure', 'manual_arrival'])) {
//if origin, destination, departure or arrival is changed, update duration
TrainCheckinController::calculateCheckinDuration($checkin);
TrainCheckinController::calculateCheckinDuration($checkin->fresh());
}
}
}

0 comments on commit 41c5c2f

Please sign in to comment.