Recalcuate aircraft stats in nightly cron and importer #585 #443 (#587)

This commit is contained in:
Nabeel S
2020-02-24 19:35:28 -05:00
committed by GitHub
parent 30786b7b27
commit 07a75de0bf
5 changed files with 76 additions and 6 deletions

View File

@@ -24,7 +24,9 @@
</tr>
<tr>
<td colspan="2"><h4>Site Config</h4></td>
<td colspan="2"><h4>Site Config</h4>
<p>Enter the database information for your legacy (v2 or v5) database</p>
</td>
</tr>
<tr>

View File

@@ -3,6 +3,7 @@
namespace Modules\Importer\Services\Importers;
use App\Models\User;
use App\Services\AircraftService;
use App\Services\UserService;
use Modules\Importer\Services\BaseImporter;
@@ -51,6 +52,8 @@ class FinalizeImporter extends BaseImporter
protected function recalculateUserStats()
{
$this->comment('--- RECALCULATING USER STATS ---');
/** @var UserService $userSvc */
$userSvc = app(UserService::class);
User::all()->each(function ($user) use ($userSvc) {
@@ -58,6 +61,18 @@ class FinalizeImporter extends BaseImporter
});
}
/**
* Update the aircraft stats with the newest/latest PIREPs
*/
protected function recalculateAircraftStats()
{
$this->comment('--- RECALCULATING AIRCRAFT STATS ---');
/** @var AircraftService $aircraftSvc */
$aircraftSvc = app(AircraftService::class);
$aircraftSvc->recalculateStats();
}
/**
* Clear the value store of any old value mappings
*/