phpvms
phpvms copied to clipboard
Same award class being checked several times when a pirep gets filed
Same award class being checked several times when a pirep gets filed (either manually or by acars).
Version 7.0.0-dev+220225.9d368e
To Reproduce
- Add simple debugging log to one of the example award classes provided
- Enable that award class you modified with log entry
- File a pirep, if manual approval is required accept that pirep from admin > pireps
- Check your laravel log
- See how many times it gets checked
Expected behavior Each award class should be checked once when a pirep gets accepted.
Example Award Class Edit (PilotHourAwards)
public function check($flight_minutes = null): bool
{
if (!is_numeric($flight_minutes)) {
Log::error('PilotHourAwards: Flight time "'.$flight_minutes.'" is not a valid flight time');
return false;
}
Log::debug('PilotHourAwards | Minutes: '.$flight_minutes.' | User: '.$this->user->name_private.' being checked for award requirements');
return $this->user->flight_time >= (int) $flight_minutes;
}
Example Log Entries (Result)
[2022-02-25 23:44:43] production.INFO: New PIREP filed [...]
[2022-02-25 23:44:43] production.INFO: NotificationEvents::onPirepFile: 8E2RyvJ136q5wbd6 filed
[2022-02-25 23:44:55] production.INFO: PIREP state update call [{"pirep_id":"8E2RyvJ136q5wbd6","new_status":"2"}]
[2022-02-25 23:44:55] production.INFO: PIREP 8E2RyvJ136q5wbd6 state change from 1 to 2
[2022-02-25 23:44:55] production.DEBUG: PilotHourAwards | Minutes: 30000 | User: B. Fatih K being checked for award requirements
[2022-02-25 23:44:55] production.DEBUG: PilotHourAwards | Minutes: 30000 | User: B. Fatih K being checked for award requirements
[2022-02-25 23:44:55] production.INFO: PIREP 8E2RyvJ136q5wbd6 state change to ACCEPTED
[2022-02-25 23:44:55] production.DEBUG: PilotHourAwards | Minutes: 30000 | User: B. Fatih K being checked for award requirements
[2022-02-25 23:44:55] production.INFO: Finance: PIREP: 8E2RyvJ136q5wbd6; pilot pay: 100, total: $91.00
[2022-02-25 23:44:55] production.DEBUG: PilotHourAwards | Minutes: 30000 | User: B. Fatih K being checked for award requirements
[2022-02-25 23:44:55] production.INFO: Received PIREP accepted event