-
Notifications
You must be signed in to change notification settings - Fork 4
Bugfix/#170 show active work instant in report #176
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
base: develop
Are you sure you want to change the base?
Bugfix/#170 show active work instant in report #176
Conversation
JonathanWekesser
commented
Mar 22, 2024
- Fixed Bug Active work only shown after a while in Report #170
- Refactored business logic from UI logic (Report Controller)
- added tests for business logic (Report Controller)
- active work is added to shown list, when isn't auto-saved yet
…some Unit Tests for Calculations
@CodiumAI-Agent /review |
PR Reviewer Guide 🔍
|
final HBox workButtonBox = new HBox(5.0); | ||
if(w.getId()==model.activeWorkItem.get().getId()){ | ||
|
||
if (work.getId() == model.activeWorkItem.get().getId() || work.getId() == 0) { |
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.
reminder for me: I do not like having this check still in the view-controller. Idea was that view just stupidly can show what the "view-model" presents it. no special logic needed.
this is why we did not merge it yet - as we now have logic in 2 places (Report.java and this class)
bugbot run |
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.
Bug: Project Filtering Uses Inconsistent Object Equality
Inconsistent project filtering logic in Report.java
. The calculateSeconds
method filters work items by project using object reference equality (w.getProject() == project
). This is problematic because Project
objects in the workedProjectsSet
(due to TreeSet
usage with Project::getIndex
comparator) or the activeWorkItem
might be different object instances for the same logical project, even if they represent the same project ID. This leads to discrepancies between calculated project work times and displayed work items, resulting in incorrect totals or missing entries in the report.
src/main/java/de/doubleslash/keeptime/controller/report/Report.java#L92-L95
KeepTime/src/main/java/de/doubleslash/keeptime/controller/report/Report.java
Lines 92 to 95 in daeebea
for (final Project project : workedProjectsSet) { | |
final List<Work> onlyCurrentProjectWork = workItems.stream() | |
.filter(w -> w.getProject() == project) | |
.collect(Collectors.toList()); |
src/main/java/de/doubleslash/keeptime/view/ReportController.java#L229-L233
KeepTime/src/main/java/de/doubleslash/keeptime/view/ReportController.java
Lines 229 to 233 in daeebea
for (Project project : report.getWorkedProjectsSet()) { | |
final List<Work> projectWorks = report.getWorkItems() | |
.stream() | |
.filter(w -> w.getProject().getId() == project.getId()) | |
.toList(); |
Was this report helpful? Give feedback by reacting with 👍 or 👎