Removed price filter (bug 885150)

The `price` column no longer existed which caused this to not find any
documents to exclude, effectively removing this part of the filter.
This commit is contained in:
Rob Hudson 2013-06-20 17:02:29 -07:00
Родитель 292ba681a7
Коммит 95643c7e2b
3 изменённых файлов: 7 добавлений и 16 удалений

Просмотреть файл

@ -248,10 +248,9 @@ class WebappSuggestionsAjax(SearchSuggestionsAjax):
res = res.filter(category__in=[self.category])
if (self.mobile or self.tablet) and not self.gaia:
if isinstance(res, S):
res = res.filter(~F(premium_type__in=amo.ADDON_PREMIUMS,
price__gt=0))
res = res.filter(~F(premium_type__in=amo.ADDON_PREMIUMS))
else:
res.exclude(premium_type__in=amo.ADDON_PREMIUMS, price__gt=0)
res.exclude(premium_type__in=amo.ADDON_PREMIUMS)
region = getattr(self.request, 'REGION', mkt.regions.WORLDWIDE)
if region:

Просмотреть файл

@ -158,9 +158,8 @@ class TestSearchFiltersAndroid(BaseOAuth):
def test_no_premium_on_android_flagged(self):
"""Ensure premium apps are filtered out on Android."""
qs = self._filter(self.req, self.query_string, **self.filter_kwargs)
ok_({'not': {'filter': {'and': [
{'range': {'price': {'gt': 0}}},
{'in': {'premium_type': (1, 2)}}]}}} in qs['filter']['and'])
ok_({'not': {'filter': {'in': {'premium_type': (1, 2)}}}}
in qs['filter']['and'])
# TODO: Remove this test when the 'allow-paid-app-search' flag is removed
@ -188,11 +187,7 @@ class TestFlaggedUsersPremiumApps(BaseOAuth):
}
self.prem_exclude = {
'not': {
'filter': {
'and': [
{'range': {'price': {'gt': 0}}},
{'in': {'premium_type': (1, 2)}}]}}}
'not': {'filter': {'in': {'premium_type': (1, 2)}}}}
def _filter(self, req, filters, **kwargs):
form = ApiSearchForm(filters)

Просмотреть файл

@ -83,14 +83,12 @@ class WebappManager(amo.models.ManagerBase):
def top_free(self, listed=True):
qs = self.visible() if listed else self
return (qs.filter(premium_type__in=amo.ADDON_FREES)
.exclude(addonpremium__price__price__isnull=False)
.order_by('-weekly_downloads')
.with_index(addons='downloads_type_idx'))
def top_paid(self, listed=True):
qs = self.visible() if listed else self
return (qs.filter(premium_type__in=amo.ADDON_PREMIUMS,
addonpremium__price__price__gt=0)
return (qs.filter(premium_type__in=amo.ADDON_PREMIUMS)
.order_by('-weekly_downloads')
.with_index(addons='downloads_type_idx'))
@ -670,8 +668,7 @@ class Webapp(Addon):
exclude_paid = (mobile or tablet) and not gaia
if exclude_paid:
srch = srch.filter(~F(premium_type__in=amo.ADDON_PREMIUMS,
price__gt=0))
srch = srch.filter(~F(premium_type__in=amo.ADDON_PREMIUMS))
return srch