Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
watch out for stupid outer joins (bug 676440)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Balogh committed Aug 4, 2011
1 parent af33bcc commit 50252bf
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions apps/addons/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ def get_objects(cls):
fields = ['addon', 'type', 'locale', 'application']
if settings.NEW_FEATURES:
from bandwagon.models import FeaturedCollection
vals = FeaturedCollection.objects.values_list(
'collection__addons', 'collection__addons__type',
'locale', 'application')
vals = (FeaturedCollection.objects
.filter(collection__addons__isnull=False)
.values_list('collection__addons',
'collection__addons__type', 'locale',
'application'))
else:
from addons.models import Addon
vals = (Addon.objects.valid().filter(feature__isnull=False)
Expand Down Expand Up @@ -151,7 +153,8 @@ def build(cls):
name = prefixer(key)
pipe.delete(name)
for row in rows:
pipe.sadd(name, row['addon'])
if row['addon']:
pipe.sadd(name, row['addon'])
pipe.execute()

@classmethod
Expand Down Expand Up @@ -194,9 +197,11 @@ def get_objects(cls):
fields = ['category', 'addon', 'feature_locales', 'app']
if settings.NEW_FEATURES:
from bandwagon.models import FeaturedCollection
vals = FeaturedCollection.objects.values_list(
'collection__addons__category', 'collection__addons', 'locale',
'application')
vals = (FeaturedCollection.objects
.filter(collection__addons__isnull=False)
.values_list('collection__addons__category',
'collection__addons', 'locale',
'application'))
else:
from addons.models import AddonCategory
vals = (AddonCategory.objects.filter(feature=True)
Expand Down Expand Up @@ -230,7 +235,8 @@ def build(cls):
name = cls.by_cat(category, app)
pipe.delete(name)
for row in rs:
pipe.sadd(name, row['addon'])
if row['addon']:
pipe.sadd(name, row['addon'])
pipe.execute()

@classmethod
Expand Down

0 comments on commit 50252bf

Please sign in to comment.