Skip to content

Commit

Permalink
Skip Manual Pireps
Browse files Browse the repository at this point in the history
PR will skip manual pireps during Network Presence checks
  • Loading branch information
FatihKoz committed Apr 8, 2023
1 parent 934da11 commit 693ba1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Listeners/Gen_AutoReject.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Modules\DisposableBasic\Listeners;

use App\Events\PirepFiled;
use App\Models\Enums\PirepSource;
use App\Models\Enums\PirepState;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
Expand Down Expand Up @@ -60,6 +61,8 @@ public function handle(PirepFiled $event)
$g_force = optional($pirep->fields->where('slug', 'landing-g-force')->first())->value;
}

$acars_pirep = ($pirep->source == PirepSource::ACARS) ? true : false;

// Reject By Aircraft (A pirep with No Aircraft is rare but may happen, should be rejected)
if (!$aircraft) {
$pirep_comments[] = array_merge($default_fields, ['comment' => 'Reject Reason: No Aircraft Registration Provided']);
Expand Down Expand Up @@ -103,14 +106,14 @@ public function handle(PirepFiled $event)
}

// Reject By Network Presence Check (IVAO/VATSIM only)
if ($reject_presence && isset($network_presence) && $network_presence < $margin_presence) {
if ($acars_pirep && $reject_presence && isset($network_presence) && $network_presence < $margin_presence) {
$pirep_comments[] = array_merge($default_fields, ['comment' => 'Reject Reason: Flights must be operated online! Network Presence below required minimums']);
$pirep_state = PirepState::REJECTED;
Log::info('Disposable Basic | Pirep:' . $pirep->id . ' Rejected automatically by Presence. Check Result:' . $network_presence . '% Requirement:' . $margin_presence . '%');
}

// Reject By Network Callsign Check (IVAO/VATSIM only)
if ($reject_callsign && isset($network_callsign) && isset($network_presence) && $network_presence > 0 && $network_callsign < $margin_presence) {
if ($acars_pirep && $reject_callsign && isset($network_callsign) && isset($network_presence) && $network_presence > 0 && $network_callsign < $margin_presence) {
$pirep_comments[] = array_merge($default_fields, ['comment' => 'Reject Reason: Flights must be operated online with proper callsigns!']);
$pirep_state = PirepState::REJECTED;
Log::info('Disposable Basic | Pirep:' . $pirep->id . ' Rejected automatically by Callsign. Check Result:' . $network_callsign . '% Requirement:' . $margin_presence . '%');
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ If you have duplicated blades and encounter problems after updating the module o

## Release / Update Notes

08.APR.23

* Updated Auto Reject (Manual pireps will not be considered during Network Presence checks)

12.MAR.23

* Added total/average passenger and freight figures to statistics
Expand Down

0 comments on commit 693ba1a

Please sign in to comment.