-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3602: Billable unbilled hours report #195
3602: Billable unbilled hours report #195
Conversation
…ableUnbilledHoursReportService
$totalHoursForAllProjects = 0; | ||
|
||
foreach ($billableWorklogs as $billableWorklog) { | ||
if (false === $billableWorklog->isBilled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this you should add a parameter "$isBilled = null" to findBillableWorklogsByWorkerAndDateRange repository method that only applies if $isBilled is not null. That would limit the number of entities you get from the database and thereby limit the memory use and execution time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great idea. I don't see a situation where it is relevant to get is_billed=null from findBillableWorklogsByWorkerAndDateRange at all, so i added a filter for this in the select.
I still want to be able to get billable worklogs, even after they are billed.
src/Repository/WorklogRepository.php
Outdated
@@ -113,7 +113,7 @@ public function findWorklogsByWorkerAndDateRange(string $workerIdentifier, \Date | |||
->getQuery()->getResult(); | |||
} | |||
|
|||
public function findBillableWorklogsByWorkerAndDateRange(string $workerIdentifier, \DateTime $dateFrom, \DateTime $dateTo) | |||
public function findBillableWorklogsByWorkerAndDateRange(\DateTime $dateFrom, \DateTime $dateTo, ?string $workerIdentifier = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking something along these lines:
public function findBillableWorklogsByWorkerAndDateRange(\DateTime $dateFrom, \DateTime $dateTo, ?string $workerIdentifier = null, bool? $isBilled = null)
{
...
if ($isBilled !== null) {
$qb->andWhere($qb->expr()->eq('worklog.isBilled', ':isBilled'))
->setParameter('isBilled', $isBilled);
}
}
And then in BillableUnbilledHoursReportService call
$billableWorklogs = $this->worklogRepository->findBillableWorklogsByWorkerAndDateRange($dateFrom, $dateTo, null, true);
Then the
if (false === $billableWorklog->isBilled()) {
would not be needed in BillableUnbilledHoursReportService. And you would process fewer entities.
…ter out is_billed values
Link to ticket
#3602
Description
Added Billable unbilled hours report, for viewing billable worklogs that have not been billed.
Screenshot of the result
N/A
Checklist