Additional logging for the stats recalculation (#358)

* Additional logging for the stats recalculation

* style fix
This commit is contained in:
Nabeel S
2019-08-10 20:42:35 -04:00
committed by GitHub
parent c1103afe8f
commit dc51897314
19 changed files with 99 additions and 43 deletions

View File

@@ -11,6 +11,7 @@ use App\Repositories\AcarsRepository;
use App\Services\AirportService;
use App\Services\AwardService;
use App\Services\DatabaseService;
use App\Services\UserService;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
@@ -35,6 +36,8 @@ class DevCommands extends Command
public function __construct(DatabaseService $dbSvc)
{
parent::__construct();
$this->redirectLoggingToFile('stdout');
$this->dbSvc = $dbSvc;
}
@@ -51,16 +54,17 @@ class DevCommands extends Command
}
$commands = [
'clear-acars' => 'clearAcars',
'clear-users' => 'clearUsers',
'compile-assets' => 'compileAssets',
'db-attrs' => 'dbAttrs',
'list-awards' => 'listAwardClasses',
'live-flights' => 'liveFlights',
'manual-insert' => 'manualInsert',
'metar' => 'getMetar',
'reset-install' => 'resetInstall',
'xml-to-yaml' => 'xmlToYaml',
'clear-acars' => 'clearAcars',
'clear-users' => 'clearUsers',
'compile-assets' => 'compileAssets',
'db-attrs' => 'dbAttrs',
'list-awards' => 'listAwardClasses',
'live-flights' => 'liveFlights',
'manual-insert' => 'manualInsert',
'metar' => 'getMetar',
'recalculate-stats' => 'recalculateStats',
'reset-install' => 'resetInstall',
'xml-to-yaml' => 'xmlToYaml',
];
if (!array_key_exists($command, $commands)) {
@@ -234,6 +238,15 @@ class DevCommands extends Command
}
}
/**
* Recalculate the stats for all users
*/
protected function recalculateStats(): void
{
$userSvc = app(UserService::class);
$userSvc->recalculateAllUserStats();
}
/**
* Delete all of the tables, etc from the database, for a clean install
*/