Skip to content

Bugfix monthly hour stats display#556

Closed
maciejSamerdak wants to merge 8 commits intomasterfrom
bugfix-monthly-hour-stats-display
Closed

Bugfix monthly hour stats display#556
maciejSamerdak wants to merge 8 commits intomasterfrom
bugfix-monthly-hour-stats-display

Conversation

@maciejSamerdak
Copy link
Collaborator

Fixes following bugs:

  • Hours total sum is displayed with days
  • If table is empty, it is still displayed
  • Reports for manager-only projects are not counted
  • All active projects are displayed, even if there's nothing to show for them

Extends projects query to include managed projects, excludes
projects with zero hours and properly formats output hours' sum.
Additionaly hides export buttons.
@maciejSamerdak maciejSamerdak added bug Something isn't working priority high Tasks with high priority labels May 16, 2020
@maciejSamerdak maciejSamerdak added this to the next_release milestone May 16, 2020
@maciejSamerdak maciejSamerdak requested a review from kbeker May 16, 2020 09:41
@maciejSamerdak maciejSamerdak self-assigned this May 16, 2020

@property
def all_projects(self) -> QuerySet:
return (self.projects.all() | self.manager_projects.all()).distinct()
Copy link
Collaborator Author

@maciejSamerdak maciejSamerdak May 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is forbidden to use filters with union() and | operator behaves strangely at times, duplicating projects.
Despite the distinct filter, annotate() can somehow still multiply results without setting the distinct flag.
If we were to use this property elsewhere, other annotation operations may not work as desired.
The only other solution is to repeat operations for each queryset and only then perform union() on them.

Copy link
Contributor

@kbeker kbeker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add test that now when summary for any project has more than 24 hours is now not shown any more as days counter. However - approve, but please add this test and then merge

@maciejSamerdak maciejSamerdak deleted the bugfix-monthly-hour-stats-display branch May 24, 2020 18:56
@kbeker
Copy link
Contributor

kbeker commented May 24, 2020

Merged into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority high Tasks with high priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants