← Back to team overview

harvest-dev team mailing list archive

[Merge] lp:~dholbach/harvest/664356 into lp:harvest

 

Daniel Holbach has proposed merging lp:~dholbach/harvest/664356 into lp:harvest.

Requested reviews:
  harvest-dev (harvest-dev)
Related bugs:
  #664356 Opportunities that are not in the final update of the opportunity list should not be displayed
  https://bugs.launchpad.net/bugs/664356

-- 
https://code.launchpad.net/~dholbach/harvest/664356/+merge/39022
Your team harvest-dev is requested to review the proposed merge of lp:~dholbach/harvest/664356 into lp:harvest.
=== modified file 'harvest/common/views.py'
--- harvest/common/views.py	2010-10-06 12:54:43 +0000
+++ harvest/common/views.py	2010-10-21 08:49:44 +0000
@@ -3,6 +3,7 @@
 from django.template import RequestContext
 from django.contrib.auth import logout
 from django.contrib.auth.models import User
+from django.db.models import F
 
 def index(request):
     from opportunities.models import SourcePackage, OpportunityList, Opportunity, Note
@@ -11,7 +12,8 @@
         'users': User.objects.count(),
         'sourcepackages': SourcePackage.objects.count(),
         'opportunitylists': OpportunityList.objects.filter(active=True).count(),
-        'opportunities': Opportunity.objects.filter(valid=True).count(),
+        'opportunities': Opportunity.objects.filter(valid=True, 
+                                last_updated=F('opportunitylist__last_updated')).count(),
         'notes': Note.objects.count(),
     }
     return render_to_response('index.html', context,

=== modified file 'harvest/opportunities/views.py'
--- harvest/opportunities/views.py	2010-10-05 13:31:20 +0000
+++ harvest/opportunities/views.py	2010-10-21 08:49:44 +0000
@@ -4,7 +4,7 @@
 from django.shortcuts import get_object_or_404
 from django.shortcuts import render_to_response as render
 from django.http import HttpResponseRedirect
-
+from django.db.models import F
 from django.template import RequestContext
 
 import models
@@ -22,7 +22,8 @@
     sourcepackages_list = filters_pkg.process_queryset(sourcepackages_list)
     
     #opportunities_list is filtered right away to only check opportunities belonging to selected packages
-    opportunities_list = models.Opportunity.objects.distinct().filter(sourcepackage__in=sourcepackages_list)
+    opportunities_list = models.Opportunity.objects.distinct().filter(sourcepackage__in=sourcepackages_list,
+                                                                      last_updated=F('opportunitylist__last_updated'))
     opportunities_list = filters_opp.process_queryset(opportunities_list)
     
     #TODO: need to filter out opportunities with valid=False again


Follow ups