added project filter in user-list reports (#4615)

This commit is contained in:
Kevin Papst
2024-02-07 18:00:29 +01:00
committed by GitHub
parent e98732f44a
commit 7abe787778
13 changed files with 139 additions and 60 deletions

View File

@@ -21,6 +21,7 @@ use App\Form\UserPreferencesForm;
use App\Form\UserRolesType;
use App\Form\UserTeamsType;
use App\Form\UserTwoFactorType;
use App\Repository\Query\TimesheetStatisticQuery;
use App\Repository\TeamRepository;
use App\Repository\TimesheetRepository;
use App\Repository\UserRepository;
@@ -84,13 +85,15 @@ final class ProfileController extends AbstractController
// but we need a full year, because the chart needs always 12 month
$begin = $dateFactory->createStartOfYear($begin);
$query = new TimesheetStatisticQuery($begin, $end, [$profile]);
$viewVars = [
'tab' => 'charts',
'page_setup' => $this->getPageSetup($profile, 'charts'),
'user' => $profile,
'stats' => $userStats,
'workingSince' => $workStartingDay,
'workMonths' => $statisticService->getMonthlyStats($begin, $end, [$profile])[0]
'workMonths' => $statisticService->getMonthlyStats($query)[0]
];
return $this->render('user/stats.html.twig', $viewVars);

View File

@@ -15,6 +15,7 @@ use App\Export\Spreadsheet\Writer\XlsxWriter;
use App\Model\DailyStatistic;
use App\Reporting\MonthlyUserList\MonthlyUserList;
use App\Reporting\MonthlyUserList\MonthlyUserListForm;
use App\Repository\Query\TimesheetStatisticQuery;
use App\Repository\Query\UserQuery;
use App\Repository\Query\VisibilityInterface;
use App\Repository\UserRepository;
@@ -106,7 +107,9 @@ final class ReportUsersMonthController extends AbstractController
$hasData = true;
if (!empty($allUsers)) {
$dayStats = $statisticService->getDailyStatistics($start, $end, $allUsers);
$statsQuery = new TimesheetStatisticQuery($start, $end, $allUsers);
$statsQuery->setProject($values->getProject());
$dayStats = $statisticService->getDailyStatistics($statsQuery);
}
if (empty($dayStats)) {

View File

@@ -15,6 +15,7 @@ use App\Export\Spreadsheet\Writer\XlsxWriter;
use App\Model\DailyStatistic;
use App\Reporting\WeeklyUserList\WeeklyUserList;
use App\Reporting\WeeklyUserList\WeeklyUserListForm;
use App\Repository\Query\TimesheetStatisticQuery;
use App\Repository\Query\UserQuery;
use App\Repository\Query\VisibilityInterface;
use App\Repository\UserRepository;
@@ -102,7 +103,9 @@ final class ReportUsersWeekController extends AbstractController
$hasData = true;
if (!empty($allUsers)) {
$dayStats = $statisticService->getDailyStatistics($start, $end, $allUsers);
$statsQuery = new TimesheetStatisticQuery($start, $end, $allUsers);
$statsQuery->setProject($values->getProject());
$dayStats = $statisticService->getDailyStatistics($statsQuery);
}
if (empty($dayStats)) {

View File

@@ -16,6 +16,7 @@ use App\Export\Spreadsheet\Writer\XlsxWriter;
use App\Model\MonthlyStatistic;
use App\Reporting\YearlyUserList\YearlyUserList;
use App\Reporting\YearlyUserList\YearlyUserListForm;
use App\Repository\Query\TimesheetStatisticQuery;
use App\Repository\Query\UserQuery;
use App\Repository\Query\VisibilityInterface;
use App\Repository\UserRepository;
@@ -107,7 +108,9 @@ final class ReportUsersYearController extends AbstractController
$hasData = true;
if (!empty($allUsers)) {
$monthStats = $statisticService->getMonthlyStats($start, $end, $allUsers);
$statsQuery = new TimesheetStatisticQuery($start, $end, $allUsers);
$statsQuery->setProject($values->getProject());
$monthStats = $statisticService->getMonthlyStats($statsQuery);
}
if (empty($monthStats)) {