← Back to team overview

harvest-dev team mailing list archive

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

 

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

Requested reviews:
  harvest-dev (harvest-dev)
Related bugs:
  #613050 Review opportunity_list.active usage
  https://bugs.launchpad.net/bugs/613050

-- 
https://code.launchpad.net/~dholbach/harvest/613050/+merge/37872
Your team harvest-dev is requested to review the proposed merge of lp:~dholbach/harvest/613050 into lp:harvest.
=== modified file 'harvest/opportunities/management/commands/updatelists.py'
--- harvest/opportunities/management/commands/updatelists.py	2010-08-03 16:29:47 +0000
+++ harvest/opportunities/management/commands/updatelists.py	2010-10-07 16:15:54 +0000
@@ -18,7 +18,9 @@
         if not os.path.exists(data_dir):
             os.makedirs(data_dir)
         list_dir = opportunity_lists.pull_lists(data_dir)
-
+        for l in OpportunityList.objects.all():
+            l.active = False
+            l.save()
         for (list_url, 
              list_description, 
              list_explanation) in opportunity_lists.read_lists(list_dir):

=== modified file 'harvest/opportunities/management/commands/updateopportunities.py'
--- harvest/opportunities/management/commands/updateopportunities.py	2010-03-02 16:04:00 +0000
+++ harvest/opportunities/management/commands/updateopportunities.py	2010-10-07 16:15:54 +0000
@@ -13,7 +13,7 @@
     help = "Pull opportunity lists and update them in the DB."
 
     def update_lists(self):
-        for op_list in models.OpportunityList.objects.all():
+        for op_list in models.OpportunityList.objects.filter(active=True):
             (entries, new_date) = opportunity_lists.read_entries(op_list.url, op_list.last_updated)
             if entries:
                 op_list.last_updated = new_date
@@ -33,7 +33,8 @@
                     opportunity.valid = True
                     opportunity.save()
             else:
-                op_list.active = False
+                if new_date:
+                    op_list.active = False
             
             if op_list.experience:
                 opportunities = models.Opportunity.objects.filter(opportunitylist=op_list,