It appears that there is a bug when you use the "Group" filter in the "Sort/filter" options of an asset list, and when the asset is in more than one group.

Specifically, if you try to filter by more than one group, and an asset is in both, it will appear twice.

This probably also affects location, because the code is shared between both.

Comments

m.stenta created an issue. See original summary.

m.stenta’s picture

Issue summary: View changes
m.stenta’s picture

I found the exact commit that added the "Group" filter option to the Animal's list: https://github.com/farmOS/farmOS/commit/e7e808de70c9ca2607bac74a7735d5f7...

Notably, it allowed "multiple" selections right from the start. What this tells me is that we did NOT add the ability to select multiple groups as a separate intentional feature request. I just enabled multiple selections by default, not knowing that it would have this duplicate issue.

So, to me this means that when I added that filter, I also introduced this bug, simply by allowing multiple selections.

This means that technically, we have potentially two separate things:

  1. A bug: selecting multiple causes duplicates
  2. A feature request: the ability to select multiple (without causing duplicates)

So, we could start by fixing #1, by disabling the ability to select multiple. It would still be possible to filter by group, but users would be restricted to a single selection at a time.

Then, if desired, we could open another feature request that adds the ability to select multiple back, but dig into it deeper and see if there's a way to do it without causing duplicates. It's possible that this will end up requiring custom Views handler code, which could be complicated. So we should also weigh the cost/benefit.

m.stenta’s picture

Title: Duplicate assets when filtering by groups » Duplicate assets when filtering by multiple groups or location

  • m.stenta committed aae2980 on 7.x-1.x
    Issue #3049153: Duplicate assets when filtering by multiple groups or...
m.stenta’s picture

Status: Active » Fixed

I fixed this bug by eliminating the option to filter by multiple groups or locations.

If we want to restore that ability, we will need to start a new feature request: "Ability to filter by multiple groups/locations (without causing duplicates)"

  • m.stenta committed 5888a34 on 7.x-1.x
    Issue #3049153: Duplicate assets when filtering by multiple groups or...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.