use events for budget calculation (#2544)

This commit is contained in:
Kevin Papst
2021-04-29 11:50:48 +02:00
committed by GitHub
parent bb94b11e37
commit e4b176a4d5
30 changed files with 384 additions and 92 deletions

View File

@@ -17,7 +17,7 @@ use App\Event\ProjectMetaDisplayEvent;
use App\Event\TimesheetMetaDisplayEvent;
use App\Event\UserPreferenceDisplayEvent;
use App\Export\ExportItemInterface;
use App\Repository\ProjectRepository;
use App\Project\ProjectStatisticService;
use App\Repository\Query\CustomerQuery;
use App\Repository\Query\TimesheetQuery;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -37,9 +37,9 @@ class HtmlRenderer
*/
protected $dispatcher;
/**
* @var ProjectRepository
* @var ProjectStatisticService
*/
private $projectRepository;
private $projectStatisticService;
/**
* @var string
*/
@@ -49,11 +49,11 @@ class HtmlRenderer
*/
private $template = 'default.html.twig';
public function __construct(Environment $twig, EventDispatcherInterface $dispatcher, ProjectRepository $projectRepository)
public function __construct(Environment $twig, EventDispatcherInterface $dispatcher, ProjectStatisticService $projectStatisticService)
{
$this->twig = $twig;
$this->dispatcher = $dispatcher;
$this->projectRepository = $projectRepository;
$this->projectStatisticService = $projectStatisticService;
}
/**
@@ -107,7 +107,7 @@ class HtmlRenderer
'entries' => $timesheets,
'query' => $query,
'summaries' => $summary,
'budgets' => $this->calculateProjectBudget($timesheets, $query, $this->projectRepository),
'budgets' => $this->calculateProjectBudget($timesheets, $query, $this->projectStatisticService),
// @deprecated since 1.3, will be removed with 2.0
'metaColumns' => $timesheetMetaFields,
'timesheetMetaFields' => $timesheetMetaFields,