camilovelandia04 Posted November 4, 2022 Report Posted November 4, 2022 Hi there, Greetings! , I would like to know how to create a rule in our system in order to auto approve a pireps when the score is equal or grater than 75%, and if not just be in standby like if not auto approve.... appreciate your help! thanks Quote
DisposableHero Posted November 5, 2022 Report Posted November 5, 2022 (edited) 14 hours ago, camilovelandia04 said: Hi there, Greetings! , I would like to know how to create a rule in our system in order to auto approve a pireps when the score is equal or grater than 75%, and if not just be in standby like if not auto approve.... appreciate your help! thanks 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. Edited November 5, 2022 by DisposableHero 1 Quote
camilovelandia04 Posted November 12, 2022 Author Report Posted November 12, 2022 It works for me, thanks a lot for your help! Quote
DisposableHero Posted November 12, 2022 Report Posted November 12, 2022 Great news, now you have your own module and build on it whenever you need something special for your VA. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.