Closed
Bug 915803
Opened 11 years ago
Closed 11 years ago
/search/featured API not filtering collections properly.
Categories
(Marketplace Graveyard :: API, defect, P1)
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®ion=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.
Updated•11 years ago
|
Blocks: mkt-publishtool-api
Assignee | ||
Comment 1•11 years ago
|
||
My guess is, there is collection with collection_type=0, is_public=1 that matches this filter, so the fallback is kicking in.
Assignee | ||
Comment 2•11 years ago
|
||
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
Assignee | ||
Comment 3•11 years ago
|
||
(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)
Reporter | ||
Comment 4•11 years ago
|
||
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 → ---
Updated•11 years ago
|
Priority: -- → P1
Assignee | ||
Comment 5•11 years ago
|
||
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 | ||
Updated•11 years ago
|
Assignee: nobody → mpillard
Assignee | ||
Comment 6•11 years ago
|
||
Status: REOPENED → ASSIGNED
Target Milestone: --- → 2013-09-17
Assignee | ||
Comment 7•11 years ago
|
||
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 ago → 11 years ago
Resolution: --- → FIXED
Whiteboard: [qa-]
Comment 8•11 years ago
|
||
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®ion=us
with
https://marketplace-dev.allizom.org/api/v1/fireplace/search/featured/?cat=&pro=6081fc0b0.45.2&carrier=deutsche_telekom®ion=us
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 9•11 years ago
|
||
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 ?
Reporter | ||
Comment 10•11 years ago
|
||
(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?
Assignee | ||
Comment 11•11 years ago
|
||
I think the problem is simply that 'featured-apps' has carrier=0 (unknown_carrier), not carrier=NULL.
Comment 12•11 years ago
|
||
(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.
Reporter | ||
Comment 13•11 years ago
|
||
Oh? I didn't realize there was a difference (isn't it "carrierless"?). I can tweak that in the UI later.
Comment 14•11 years ago
|
||
(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 "-----".
Reporter | ||
Comment 15•11 years ago
|
||
(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
Assignee | ||
Comment 16•11 years ago
|
||
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 ?
Reporter | ||
Comment 17•11 years ago
|
||
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?
Comment 18•11 years ago
|
||
https://github.com/mozilla/rocketfuel/commit/c37d2e90
Looks perfect. Thanks, team!
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•