Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: incorrect duplicate filter check #24001

Merged
merged 2 commits into from
Dec 28, 2023
Merged

Conversation

ankush
Copy link
Member

@ankush ankush commented Dec 28, 2023

The duplicate filter check was returing true if ANY of the field match the filters. It should be only returning true for specific filters.

If the page you open is:
/app/doctype?description=["in",["a","b"]]&name=["in",["a","b"]]
You will find that the name is not filtered in the filter.
And the page path will be changed by the page to /app/doctype?description=["in",["a","b"]]

But if you open the page is:
/app/doctype?description=["in",["a","b"]]&name=["in",["a","b","c"]]
Contains a filter for name.

Because in the first page, the values in the filter are all ["a", "b" ], which is judged to be the same filtering information.

  • fix: Solve the problem that the filter conditions are regarded as the same when the filter values are equivalent arrays in the filter
  • refactor: simplify duplicate filter checking code

alternate to #23951

fierflame and others added 2 commits December 26, 2023 20:17
… same when the filter values are equivalent arrays in the filter
keeping track of `exists` variable is weird to read and prone to bugs...
what if next field makes exist = false, even if one filter already
exists?
@ankush ankush requested review from a team and akhilnarang and removed request for a team December 28, 2023 09:25
@ankush ankush changed the title fix filter check fix: incorrect duplicate filter check Dec 28, 2023
@ankush ankush merged commit 3a918fb into frappe:develop Dec 28, 2023
21 of 22 checks passed
@ankush ankush deleted the fix_filter_check branch December 28, 2023 09:26
@ankush ankush added backport version-14-hotfix backport to version 14 backport version-15-hotfix Backport the PR to v15 labels Dec 28, 2023
ankush added a commit that referenced this pull request Dec 28, 2023
* fix: Solve the problem that the filter conditions are regarded as the same when the filter values are equivalent arrays in the filter

(cherry picked from commit 3ee00cf)

* refactor: simplify duplicate filter checking code

keeping track of `exists` variable is weird to read and prone to bugs...
what if next field makes exist = false, even if one filter already
exists?

(cherry picked from commit acf032f)

---------

Co-authored-by: Fierflame <git@fierflame.com>
Co-authored-by: Ankush Menat <ankush@frappe.io>
ankush added a commit that referenced this pull request Dec 28, 2023
* fix: Solve the problem that the filter conditions are regarded as the same when the filter values are equivalent arrays in the filter

(cherry picked from commit 3ee00cf)

* refactor: simplify duplicate filter checking code

keeping track of `exists` variable is weird to read and prone to bugs...
what if next field makes exist = false, even if one filter already
exists?

(cherry picked from commit acf032f)

---------

Co-authored-by: Fierflame <git@fierflame.com>
Co-authored-by: Ankush Menat <ankush@frappe.io>
frappe-pr-bot pushed a commit that referenced this pull request Jan 2, 2024
# [15.8.0](v15.7.0...v15.8.0) (2024-01-02)

### Bug Fixes

* **Blog Post:** correct indicator filter ([9b43326](9b43326))
* Check permissions before rendering web view ([#24032](#24032)) ([#24035](#24035)) ([aac98f0](aac98f0))
* Consider allDay on Calendar View ([2f767c8](2f767c8))
* **Data Import:** show failed import logs ([64b45eb](64b45eb))
* **data_import:** respect the value of show_failed_logs checkbox ([98098a4](98098a4))
* Do not change global search label to lower case ([8befc7d](8befc7d))
* **DX:** filter version logs with changes to field ([#24023](#24023)) ([#24025](#24025)) ([07d7e63](07d7e63))
* **DX:** store tracebacks with context ([#24059](#24059)) ([#24063](#24063)) ([ebcd970](ebcd970))
* **Geo:** Add timezone for palestinian territory country ([#23986](#23986)) ([#23993](#23993)) ([668e02d](668e02d))
* incorrect duplicate filter check (backport [#24001](#24001)) ([#24003](#24003)) ([b29077e](b29077e))
* lint ([1c7f3c8](1c7f3c8))
* linters ([91d30d4](91d30d4))
* linters ([e742b0f](e742b0f))
* **minor:** mobile menu class ([#23970](#23970)) ([#23971](#23971)) ([b1e0f63](b1e0f63))
* **minor:** Onboarding check if element available ([#23947](#23947)) ([#23969](#23969)) ([9cc6ddb](9cc6ddb))
* **minor:** spacing for sidebar item with child items ([01121b6](01121b6))
* misc errors from sentry (backport [#24009](#24009)) ([#24012](#24012)) ([4d2246e](4d2246e))
* number card layout (backport [#23287](#23287)) ([#23972](#23972)) ([1035a5e](1035a5e))
* Rate control read only mode ([#24055](#24055)) ([#24057](#24057)) ([b1c6edc](b1c6edc))
* remove Guest permission on Help Article ([#24082](#24082)) ([#24084](#24084)) ([0a55b18](0a55b18))
* roles editor ([#23976](#23976)) ([#23979](#23979)) ([4cbdc48](4cbdc48))
* **sentry:** don't set context if not enabled ([891724b](891724b))
* Set default child table fields on save ([#23913](#23913)) ([#23984](#23984)) ([c772391](c772391))
* show relative path in loaded JS ([#23964](#23964)) ([cdcd920](cdcd920))
* show right permission for user cannot create doctypes ([#24027](#24027)) ([#24029](#24029)) ([10941c5](10941c5))
* Solve the problem that the document editor will report an error when the type name includes multiple spaces ([#23940](#23940)) ([23bc9c5](23bc9c5))
* Solve the problem that there is no forEach instance method in HTMLCollection in some environments, which leads to the failure of camera-related functions. ([#23988](#23988)) ([f752fb3](f752fb3))
* strip exc from json response if traceback not allowed ([#23989](#23989)) ([#23990](#23990)) ([b94186c](b94186c))
* sudan country info ([#23709](#23709)) ([6b24b9a](6b24b9a))
* **UX:** remove delay from numeric inputs and fix parsing (backport [#23759](#23759) &  [#23143](#23143) ) ([#23778](#23778)) ([c86032e](c86032e))
* validate server scripts with FrappeTransformer ([#24068](#24068)) ([#24070](#24070)) ([c9b7ab2](c9b7ab2))

### Features

* Hook to add custom route resolver ([fce10bd](fce10bd))
* **sentry:** log request json body / form data ([5a9bdee](5a9bdee))
* **sentry:** skip validation errors ([92e16b1](92e16b1))
* sort multicheck by label ([#23985](#23985)) ([205e519](205e519))

### Performance Improvements

* skip network call if no doc ([#23967](#23967)) ([#23974](#23974)) ([4331c04](4331c04))
frappe-pr-bot pushed a commit that referenced this pull request Jan 2, 2024
# [14.62.0](v14.61.0...v14.62.0) (2024-01-02)

### Bug Fixes

* **Blog Post:** correct indicator filter ([a3534b1](a3534b1))
* Check permissions before rendering web view (backport [#24032](#24032)) (backport [#24035](#24035)) ([#24037](#24037)) ([c9f27bf](c9f27bf))
* Consider allDay on Calendar View ([7fe3a01](7fe3a01))
* **Data Import:** show failed import logs ([8fe056e](8fe056e))
* **data_import:** respect the value of show_failed_logs checkbox ([d847c66](d847c66))
* **DX:** filter version logs with changes to field ([#24023](#24023)) ([#24024](#24024)) ([7b6db51](7b6db51))
* **Geo:** Add timezone for palestinian territory country ([#23986](#23986)) ([#23992](#23992)) ([d17c79d](d17c79d))
* image cropper context in translation ([64cb298](64cb298))
* incorrect duplicate filter check (backport [#24001](#24001)) ([#24002](#24002)) ([28c9a86](28c9a86))
* lint ([43c72b5](43c72b5))
* linters ([9c2205d](9c2205d))
* linters ([af02dbe](af02dbe))
* Merge conflicts ([27daa8b](27daa8b))
* **minor:** Onboarding check if element available ([#23947](#23947)) ([#23968](#23968)) ([6a5b8d0](6a5b8d0))
* misc errors from sentry (backport [#24009](#24009)) ([#24011](#24011)) ([4b93385](4b93385))
* Rate control read only mode ([#24055](#24055)) ([#24056](#24056)) ([d92f537](d92f537))
* remove Guest permission on Help Article (backport [#24082](#24082)) ([#24083](#24083)) ([0bf46ff](0bf46ff))
* roles editor ([#23976](#23976)) ([#23978](#23978)) ([145d6bd](145d6bd))
* Set default child table fields on save ([#23913](#23913)) ([9168d01](9168d01))
* show relative path in loaded JS ([#23964](#23964)) ([3f01c53](3f01c53))
* show right permission for user cannot create doctypes ([#24027](#24027)) ([#24028](#24028)) ([6adb718](6adb718))
* Solve the problem that there is no forEach instance method in HTMLCollection in some environments, which leads to the failure of camera-related functions. ([#23987](#23987)) ([a66b5df](a66b5df))
* strip EXC if tracebacks are disabled ([#23991](#23991)) ([316b19e](316b19e))
* **test_customize_form:** drop checking of `flags.update_db` ([75a1bc5](75a1bc5))
* Treat Document Links entries as all non-std fields ([a792fa2](a792fa2))

### Features

* sort multicheck by label ([#23985](#23985)) ([5cad670](5cad670))

### Performance Improvements

* skip network call if no doc ([#23967](#23967)) ([4574af6](4574af6))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-14-hotfix backport to version 14 backport version-15-hotfix Backport the PR to v15
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants