phpvms/app/Cron/Nightly/RecalculateStats.php
Nabeel S dc51897314
Additional logging for the stats recalculation (#358)
* Additional logging for the stats recalculation

* style fix
2019-08-10 20:42:35 -04:00

39 lines
802 B
PHP

<?php
namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Services\UserService;
use Illuminate\Support\Facades\Log;
/**
* This recalculates the balances on all of the journals
*/
class RecalculateStats extends Listener
{
private $userSvc;
public function __construct(UserService $userService)
{
$this->userSvc = $userService;
}
/**
* Recalculate the stats for active users
*
* @param CronNightly $event
*
* @throws \UnexpectedValueException
* @throws \InvalidArgumentException
*/
public function handle(CronNightly $event): void
{
Log::info('Recalculating balances');
$this->userSvc->recalculateAllUserStats();
Log::info('Done recalculating stats');
}
}