Closed Bug 915803 Opened 11 years ago Closed 11 years ago

/search/featured API not filtering collections properly.

Categories

(Marketplace Graveyard :: API, defect, P1)

Avenir
x86_64
Windows 7
defect

Tracking

(Not tracked)

RESOLVED FIXED
2013-09-17

People

(Reporter: basta, Assigned: mat)

References

Details

(Whiteboard: [qa-])

https://marketplace-dev.allizom.org/api/v1/fireplace/search/featured/?carrier=carrierless&cat=&lang=en-US&pro=60a1fc0f0.45.2&region=us The above URL is returning the "social-media" collection. The parameters passed indicate that the collections should be filtered for the US, but the social-media collection is for the German region.
My guess is, there is collection with collection_type=0, is_public=1 that matches this filter, so the fallback is kicking in.
Confirmed, it's using the fallback because it can not find any collections matching collection_type=0, is_public=1 + your filter. So it tries dropping the region and finds "social-media". There is a match, "new-us-collection" but it's not public so it's not picking it up.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
(https://bugzilla.mozilla.org/show_bug.cgi?id=914318 will help debug these kind of issues in the future - it's non trivial with the drf/tastypie mixing, though)
The filtering should never match a region that doesn't exactly match the region of the request or null. We should, for instance, never show users in the US region a collection meant for users in Spain.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Priority: -- → P1
Per discussion on IRC, the fallback system needs to change: <mat> basta: what you want is, instead of dropping filter(s), replace their value with NULL, and stop automatically including NULLs for the normal, non-fallback case ? <basta> mat: yeah, that sounds exactly like what we need
Assignee: nobody → mpillard
Status: REOPENED → ASSIGNED
Target Milestone: --- → 2013-09-17
Fixed in https://github.com/mozilla/zamboni/commit/c22557b56fef8f9e5b74136a4326d5bc5aa49669 Basta, please verify or re-open once this lands on -dev, thanks :)
Status: ASSIGNED → RESOLVED
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
Whiteboard: [qa-]
1) Load https://marketplace-dev.allizom.org/?mcc=216&mnc=30 From your console: > require('user').get_setting('carrier') "deutsche_telekom" > require('user').get_setting('region') "us" 2) Notice featured apps are missing. 3) Clear your localStorage from your console: localStorage.clear() 4) Load https://marketplace-dev.allizom.org/ 5) Notice featured apps are there. Expected behaviour: Because there is a featured apps collection - https://marketplace-dev.allizom.org/curation/collection/featured-apps - we should be falling back to that if there exists none for the carrier/region combination. Actual behaviour: We're not. Compare https://marketplace-dev.allizom.org/api/v1/fireplace/search/featured/?cat=&pro=6081fc0b0.45.2&region=us with https://marketplace-dev.allizom.org/api/v1/fireplace/search/featured/?cat=&pro=6081fc0b0.45.2&carrier=deutsche_telekom&region=us
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
This is what I had in place before changing the fallback system to match basta's wishes :( What we had before: - Carrier and region filters can be dropped completely if no match is found with the current filters (in a specific order: first region, then carrier, then both) - NULL values are considered a match (a collection with region=NULL would be considered a match for region=us) What we have now: - Carrier and region filters value is changed to NULL if no match is found with the current filters (in the same specific order: first region, then carrier, then both) Can you guys both validate the exact behaviour we want ?
(In reply to Mathieu Pillard [:mat] from comment #9) > This is what I had in place before changing the fallback system to match > basta's wishes :( > > What we had before: > - Carrier and region filters can be dropped completely if no match is found > with the current filters (in a specific order: first region, then carrier, > then both) > - NULL values are considered a match (a collection with region=NULL would be > considered a match for region=us) > > What we have now: > - Carrier and region filters value is changed to NULL if no match is found > with the current filters (in the same specific order: first region, then > carrier, then both) What cvan is looking for appears to be what the new behavior should be, I think this is an edge case though. The filters shouldn't be dropped outright (you should only ever see any collection for your own carrier/region/cat or NULL, but never any other values for carrier/region/cat). The algorithm you're describing *should* work. Here's the request from the URL cvan posted: <home>?region=us&carrier=deutsche_telekom There are obviously no matches for that exactly, so it should go through the following permutations: <home>?region=NULL&carrier=deutsche_telekom <home>?region=us&carrier=NULL <home>?region=NULL&carrier=NULL At that point, it should match the 'featured-apps' collection, which has the following properties: { carrier: 0, region: 0, category: null (homepage) } Unless I'm missing something, cvan is right. Any ideas?
I think the problem is simply that 'featured-apps' has carrier=0 (unknown_carrier), not carrier=NULL.
(In reply to Matt Basta [:basta] from comment #10) > There are obviously no matches for that exactly, so it should go through the > following permutations: > > <home>?region=NULL&carrier=deutsche_telekom > <home>?region=us&carrier=NULL > <home>?region=NULL&carrier=NULL Yep, that's exactly what I was looking for. If this isn't how the fallback system works, we're going to need to add a featured apps collection for every single carrier, which is not trivial.
Oh? I didn't realize there was a difference (isn't it "carrierless"?). I can tweak that in the UI later.
(In reply to Matt Basta [:basta] from comment #13) > Oh? I didn't realize there was a difference (isn't it "carrierless"?). I can > tweak that in the UI later. Interesting, as I had not selected "carrierless" but "-----".
(In reply to Christopher Van Wiemeersch [:cvan] from comment #14) > (In reply to Matt Basta [:basta] from comment #13) > > Oh? I didn't realize there was a difference (isn't it "carrierless"?). I can > > tweak that in the UI later. > > Interesting, as I had not selected "carrierless" but "-----". The slug for the carrier is "carrierless". The UI has: <option value="carrierless">-----</option> I was afraid someone would see "carrierless" and not know that it means "no carrier", thinking "carrierless" was the name of a carrier lol
And to make things more confusing, carrierless class name in python is actually UNKNOWN_CARRIER, and its value is 0. But yeah, definitely different from NULL values. So are we good here, API-wise ?
Let me give this a good think, update the ui, and test that this fixes the issue that cvan is seeing. I'll try to have it taken care of this morning and we can decide whether there's anything to do here, heyna or no?
Status: REOPENED → RESOLVED
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.