Closed arthurpar06 closed 1 month ago
This remain hidden and not noticed because of nightly stats re-calculation probably... But unfortunately there is an open risk there too :wink:
That method does not check if the pirep is in pending, accepted or rejected state either and uses all pireps (including even cancelled ones)... So if an admin decides to keep all pireps in their db, not deleting them, this will not end up nice.
I think we may need a PR for this method too, at least to include only ACCEPTED pireps.
What do you think ?
Describe the bug When a PIREP is rejected, the
reject
method of thePirepService
is called. This method decreases the aircraft's flight time by the flight time of the PIREP (see below). https://github.com/nabeelio/phpvms/blob/2f8a8dfb0e16f9a9ed242b0bd3f655f82c98a4a0/app/Services/PirepService.php#L702-L703However, the aircraft's flight time is only incremented when the
accept
method of thePirepService
is called (i.e., when the PIREP is accepted), as seen here: https://github.com/nabeelio/phpvms/blob/2f8a8dfb0e16f9a9ed242b0bd3f655f82c98a4a0/app/Services/PirepService.php#L663This creates an issue when a PIREP is in a pending state (with auto-accept disabled). If the admin chooses to reject the PIREP, the flight time is deducted from the aircraft's total flight time, causing the aircraft's flight time to be less than it was before the PIREP was submitted.
Version Latest dev
To Reproduce Steps to reproduce the behavior:
Expected behavior The aircraft's flight time should not change if the PIREP is rejected since no accepted PIREPs were recorded for this aircraft.
Screenshots
Before:
Pirep:
After: