feat(stats): filter (in)active tasks #56
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #55.
I took the liberty to refactor the interface to
getStats
so it's a bit cleaner to pass arguments for different situations (i.e. w/ interval or not).Feel free to change stuff around; you might want to rename some stuff or re-format (I don't like long lines since I sometimes use split panes/windows and line wraps make code less readable IMO, but you're the boss here).
✨ Copilot summary
This pull request introduces a new feature to filter tasks based on their active status in the
hours
application. The changes span multiple files and add functionality to view active, inactive, or both types of tasks in various reports.New Feature: Task Active Status Filter
cmd/root.go
: Added flags--active
and--inactive
to filter tasks based on their active status in thestats
command. UpdatedRenderStats
call to include the new filter parameter. [1] [2] [3]internal/types/types.go
: IntroducedTaskActiveStatusFilter
type and constants to represent active, inactive, and both task filters. Added methods to check the filter status.internal/persistence/queries.go
: ModifiedFetchStats
andFetchStatsBetweenTS
functions to accept the new filter and apply it in SQL queries. [1] [2]internal/ui/stats.go
: UpdatedRenderStats
function to use the new filter and refactored to use astatsFetcher
struct for fetching stats based on the filter. [1] [2] [3] [4]internal/ui/cmds.go
,internal/ui/initial.go
,internal/ui/log.go
,internal/ui/model.go
,internal/ui/report.go
,internal/ui/update.go
: Updated various functions and models to pass and handle the newactiveFilter
parameter. [1] [2] [3] [4] [5] [6] [7] [8] [9]These changes collectively add the ability to filter tasks by their active status, enhancing the usability of the
hours
application by allowing users to focus on specific types of tasks in their reports.