Skip to content

Feature/72453 add has spent time filter to work packages#22089

Open
JureU wants to merge 3 commits intoopf:devfrom
JureU:feature/72453-add-has-spent-time-filter-to-work-packages
Open

Feature/72453 add has spent time filter to work packages#22089
JureU wants to merge 3 commits intoopf:devfrom
JureU:feature/72453-add-has-spent-time-filter-to-work-packages

Conversation

@JureU
Copy link
Contributor

@JureU JureU commented Feb 24, 2026

Ticket

(https://community.openproject.org/projects/openproject/work_packages/72453/activity)

What are you trying to accomplish?

Adds a new Work Package filter "Has spent time" that allows filtering Work Packages which have time logged within a specified date range. This helps project managers quickly identify which work packages were actively worked on during a given period.

Screenshots

As seen in the screenshot, only Work Packages which have time logged in the selected time frame are shown.

image

What approach did you choose and why?

The filter uses an EXISTS subquery against the time_entries table on the spent_on column, checking for entries with hours > 0 within the given date range. This approach was chosen because:

  • It is consistent with how other Work Package filters query related tables in OpenProject
  • The EXISTS subquery is efficient — it short-circuits as soon as one matching time entry is found, rather than joining and aggregating all entries
  • It reuses the existing BetweenDate operator and DateInterval strategy already present in the query filter infrastructure, keeping the implementation minimal and coherent with the rest of the codebase

An alternative would have been a JOIN with GROUP BY, but that adds unnecessary complexity and is slower when only existence needs to be checked.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant