Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix(filterFilter) deeply-nested predicate objects + multiple conditions were not giving expected results #7329

Closed

Conversation

albertboada
Copy link

Request Type: bug

How to reproduce:

http://plnkr.co/edit/Yd705mYbqKJ3n79TXLmx?p=preview

Component(s): misc core

Impact: medium

Complexity: small

Detailed Description:

Fixes current filterFilter's implementation (introduced in 1.2.13 as a result of #6215) for deeply-nested predicate objects + multiple conditions scenarios.

Problem: when using deeply nested predicate objects, filterFilter is currently behaving as if it was using OR operators (i.e. it doesn't matter if some conditions don't match as long as one does), and should be behaving as if it used AND operators in order to be consistent with the original implementation for non-deeply-nested predicate objects.

@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#7329)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@caitp
Copy link
Contributor

caitp commented May 2, 2014

oh no, did I make the API behave in weird and inconsistent ways! teh shame, teh shame.

@albertboada albertboada changed the title Fixes filterFilter with deeply-nested predicate objects + multiple conditions fix(filterFilter) deeply-nested predicate objects + multiple conditions were not giving expected results May 2, 2014
@albertboada
Copy link
Author

It looked like to me! Or maybe I was too sleepy, lol. Could you confirm (that I wasn't too sleepy)?? Thanks!

@mary-poppins
Copy link

I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS.

Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match.

If you signed the CLA as a corporation, please let us know the company's name.

Thanks a bunch!

PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR.
PS2: If you are a Googler, please sign the CLA as well to simplify the CLA verification process.

@albertboada
Copy link
Author

@mary-poppins, I know you will probably not understand me, but just signed the CLA :)

@mary-poppins
Copy link

CLA signature verified! Thank you!

Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes).

@Narretz Narretz modified the milestones: Backlog, 1.3.0 Jul 2, 2014
@albertboada
Copy link
Author

@caitp Any change of getting this reviewed anytime? 😳

if (textKey.charAt(0) === '$' || !hasOwnProperty.call(text, textKey) ||
!comparator(obj[textKey], text[textKey])) {
passes = false;
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return false;

@caitp
Copy link
Contributor

caitp commented Jul 5, 2014

A few nits there, it's easier to read if we're just returning rather than keeping an extra state variable and switching it on.

Another alternative would be just making it default to true and setting it to false if you notice a problem.

Anyways, the tests look good, this needs to be squashed to one commit with a message following the commit message guidelines at https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit

Apart from all that I don't see any obvious problems with it

@albertboada
Copy link
Author

Thanks for the tips! Should be good to go now (I guess!) :)

…itions not returning expected filtered results

Current implementation of `filterFilter` when using deeply nested predicate objects + multiple conditions behaves like if it used _OR_ operators (i.e. it doesn't matter if some conditions don't match as long as one does), and should be behave like if it used _AND_ operators in order to be consistent with the original implementation for non-deeply-nested predicate objects.

`filterFilter` working with deeply-nested predicate objects was introduced in 1.2.13 as a result of angular#6215.
@sebholstein
Copy link
Contributor

+1

@albertboada
Copy link
Author

@SebastianM myeah, deep filtering has been broken probably for too long now for a first-class tool like this one. Both this very pull request (#7329) and #6623 should be taken into consideration for a one-time-fix of deep filters introduced in February. @caitp any roadmap on this?

@albertboada
Copy link
Author

Closing this, finally! in favour of #9757 :)

@albertboada albertboada closed this Dec 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants