List view should not assume default filter anymore #2234

Closed
opened 2024-03-23 13:25:30 +00:00 by waza-ari · 2 comments
Contributor

Description

Currently, when creating a list view, it assumes a default filter done = false. With the new views, this should not be applied unconditionally anymore, instead it should be the default when a new list view is created, but should be configurable by the user.

In our case I'm creating a Kanban view with a filter like done = false || (done = true && done_at > 'now-14d') to show all tasks but limit the length of the done column, and then I'm adding another list view with the filter done = true to show all done tasks. When doing that, the default filter done = false directly contradicts the filter I have configured, showing no tasks at all unless the filter is cleared every time the view is opened.

I'd propose to have the done = false filter applied by default when creating a new view (and part of the standard view), but basically move this to the view filter logic.

Vikunja Version

unstable

Browser and version

No response

Can you reproduce the bug on the Vikunja demo site?

Yes

Screenshots

No response

### Description Currently, when creating a list view, it assumes a default filter `done = false`. With the new views, this should not be applied unconditionally anymore, instead it should be the default when a new list view is created, but should be configurable by the user. In our case I'm creating a Kanban view with a filter like `done = false || (done = true && done_at > 'now-14d')` to show all tasks but limit the length of the `done` column, and then I'm adding another list view with the filter `done = true` to show all done tasks. When doing that, the default filter `done = false` directly contradicts the filter I have configured, showing no tasks at all unless the filter is cleared every time the view is opened. I'd propose to have the `done = false` filter applied by default when creating a new view (and part of the standard view), but basically move this to the view filter logic. ### Vikunja Version unstable ### Browser and version _No response_ ### Can you reproduce the bug on the Vikunja demo site? Yes ### Screenshots _No response_
waza-ari added the
kind/bug
label 2024-03-23 13:25:30 +00:00
Author
Contributor

I've been looking into the code and I'm not sure how to handle this. The view filter is applied in the backend, while the default filter done=false is applied in the frontend. It's easy to disable this default filter, but disabling it based on the condition that there's a view filter present is difficult, as this information is not available in the frontend.

The only option I could envision right now is to:

  • Do not set a default filter for list view
  • Set a default filter for new list based views during creation (mainly frontend)
  • Migrate all existing list views to add this filter if the current filter is empty

This however could lead to another unwanted behaviour, if someone was using the new views already, created filtered list views already, relying on the fact that done tasks would be excluded. That might be a niche case though

I've been looking into the code and I'm not sure how to handle this. The view filter is applied in the backend, while the default filter `done=false` is applied in the frontend. It's easy to disable this default filter, but disabling it based on the condition that there's a view filter present is difficult, as this information is not available in the frontend. The only option I could envision right now is to: - Do not set a default filter for list view - Set a default filter for new list based views during creation (mainly frontend) - Migrate all existing list views to add this filter if the current filter is empty This however could lead to another unwanted behaviour, if someone was using the new views already, created filtered list views already, relying on the fact that done tasks would be excluded. That might be a niche case though
Owner

Ahh yes, that makes a lot of sense!

To fix this, I would

  • adjust this function to add the done = false filter when creating the default views
  • add a migration to add the filter to all list views which currently exist
  • remove the default filter condition in the frontend - then only the one saved in the view will be applied.

So basically what you said :)

I think the last point, people who are already using this would be a niche use case, especially since the features is not released yet. The goal should be to keep the default behaviour if uses didn't change anything, that means show only undone tasks in list view by default.

Ahh yes, that makes a lot of sense! To fix this, I would * adjust [this function](https://kolaente.dev/vikunja/vikunja/src/branch/main/pkg/models/project_view.go#L380) to add the `done = false` filter when creating the default views * add a migration to add the filter to all list views which currently exist * remove the default filter condition in the frontend - then only the one saved in the view will be applied. So basically what you said :) I think the last point, people who are already using this would be a niche use case, especially since the features is not released yet. The goal should be to keep the default behaviour if uses didn't change anything, that means show only undone tasks in list view by default.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: vikunja/vikunja#2234
No description provided.