Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/12/22 in all areas

  1. What about setting it to auto accept (acars pireps) at rank settings and then rejecting only reports with a score lower than 75 ? It will be much practical and easier. Yesterday I shared an example and simple pirep evaluation listener (which can be improved and integrated to your own module for v7 easily), you can check it at phpVMS Discord. Or you can check below for a much simple example for your needs. <?php namespace Modules\YOUR_MODULE_FOLDER_HERE\Listeners; use App\Events\PirepFiled; use App\Models\Enums\PirepSource; use App\Models\Enums\PirepState; class Pirep_AutoReject { public function handle(PirepFiled $event) { $pirep = $event->pirep; if ($pirep->fuel_used->internal() < 5) { // Fuel Burn is less than 5 Pounds -> REJECT $pirep_state = PirepState::REJECTED; } if ($pirep->flight_time < 10) { // Flight Time is less than 10 Minutes -> REJECT $pirep_state = PirepState::REJECTED; } if ($pirep->source == PirepSource::ACARS && $pirep->score < 75) { // Score is less than 75 -> REJECT $pirep_state = PirepState::REJECTED; } // Check if this pireps need to be REJECTED, write the state back to model and save // Do not try to ACCEPT the pirep here as it should be handled by v7 itself, // Just set it to auto accept at rank settings and only REJECT here if you need to ;) // Save your time if (isset($pirep_state)) { $pirep->state = $pirep_state; $pirep->save(); } } } Good luck Important Note: For this to work, you need to have a custom module and it needs to be listening phpVMS v7 events. Some phpvms v7 development + laravel + php knowledge is needed, this is not something to copy and paste.
    1 point
×
×
  • Create New...