Skip to content

Conversation

JonathanWekesser
Copy link

@JonathanWekesser JonathanWekesser self-assigned this Mar 22, 2024
@JonathanWekesser JonathanWekesser marked this pull request as ready for review March 22, 2024 14:26
@Death111 Death111 changed the base branch from feature/update_dependencies to feature/macSupport April 7, 2024 13:38
@sesturm
Copy link
Member

sesturm commented Jun 21, 2024

@CodiumAI-Agent /review

@CodiumAI-Agent
Copy link

PR Reviewer Guide 🔍

⏱️ Estimated effort to review [1-5] 3
🧪 Relevant tests Yes
🔒 Security concerns No
⚡ Key issues to review Possible Bug:
The logic for adding the active work item to the workItems list in the Report class does not check if the active work item's date matches the report's date. This could lead to incorrect data being displayed for reports not meant for the current date.
Refactoring Suggestion:
The method fetchWorkItems in the Report class could be refactored to improve readability and separation of concerns. Consider breaking down the method into smaller, more focused methods.
Performance Concern:
The use of streams and filters in multiple places within the Report class could lead to performance issues with large datasets. Consider optimizing these operations or using more efficient data structures.

Base automatically changed from feature/macSupport to develop January 9, 2025 15:11
final HBox workButtonBox = new HBox(5.0);
if(w.getId()==model.activeWorkItem.get().getId()){

if (work.getId() == model.activeWorkItem.get().getId() || work.getId() == 0) {
Copy link
Collaborator

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)

@sesturm
Copy link
Member

sesturm commented Jul 9, 2025

bugbot run

Copy link

@cursor cursor bot left a 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

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

for (Project project : report.getWorkedProjectsSet()) {
final List<Work> projectWorks = report.getWorkItems()
.stream()
.filter(w -> w.getProject().getId() == project.getId())
.toList();

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants