From 2ecf4d94e4d852c02fb9d8d945197c63ec75ef01 Mon Sep 17 00:00:00 2001 From: Andromeda Yelton Date: Thu, 16 May 2013 11:43:25 -0400 Subject: [PATCH 1/2] work lists with active campaigns should highlight them --- frontend/views.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/views.py b/frontend/views.py index b449539e..c71197dd 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -615,15 +615,20 @@ class WorkListView(FilterableListView): context['works_unglued'] = works_unglued.order_by('-campaigns__status', 'campaigns__deadline', '-num_wishes')[:self.max_works] context['works_active'] = qs.filter(campaigns__status='ACTIVE').distinct()[:self.max_works] context['works_wished'] = qs.exclude(editions__ebooks__isnull=False).exclude(campaigns__status='ACTIVE').exclude(campaigns__status='SUCCESSFUL').distinct()[:self.max_works] - - context['activetab'] = "#3" - + counts={} counts['unglued'] = context['works_unglued'].count() counts['unglueing'] = context['works_active'].count() counts['wished'] = context['works_wished'].count() context['counts'] = counts + if context['works_active']: + context['activetab'] = "#2" + elif context['works_unglued']: + context['activetab'] = "#1" + else: + context['activetab'] = "#3" + return context class ByPubView(WorkListView): From 830e1248c3b40dcb30d2676924678b9336046609 Mon Sep 17 00:00:00 2001 From: Andromeda Yelton Date: Fri, 17 May 2013 11:30:22 -0400 Subject: [PATCH 2/2] probably more efficient --- frontend/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/views.py b/frontend/views.py index c71197dd..c95b548f 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -622,9 +622,9 @@ class WorkListView(FilterableListView): counts['wished'] = context['works_wished'].count() context['counts'] = counts - if context['works_active']: + if counts['unglueing']: context['activetab'] = "#2" - elif context['works_unglued']: + elif counts['unglued']: context['activetab'] = "#1" else: context['activetab'] = "#3"