Skip to contentSkip to conversation

views.py: Fix current up to date percentage

PATCH New [email protected] 1 participant 1 message Jul 1, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 views.py: Fix current up to date percentage

From: Mariano Lopez <[email protected]>

There was an issue where the current up to date was always using the latest upstream version to get the percentage. This uses the upstream version in the period displayed.

---
 rrs/models.py | 5 +++++
 rrs/views.py  | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)
rrs/models.py +5 -0
index f0d4ed3..d0e88b9 100644
@@ -272,6 +272,11 @@ class RecipeUpstream(models.Model):
     date = models.DateTimeField(db_index=True)
 
     @staticmethod
+    def get_all_recipes(history):
+        qry = RecipeUpstream.objects.filter(history = history)
+        return qry
+
+    @staticmethod
     def get_recipes_not_updated(history):
         qry = RecipeUpstream.objects.filter(history = history, status = 'N',
                 no_update_reason = '').order_by('pn')
rrs/views.py +2 -2
index 4a1e9bb..dbdf9cd 100644
@@ -42,8 +42,8 @@ def _get_milestone_statistics(milestone, maintainer_name=None):
     )
 
     if maintainer_name is None:
-        milestone_statistics['all'] = Recipe.objects.all().count()
-
+        milestone_statistics['all'] = \
+            RecipeUpstream.get_all_recipes(recipe_upstream_history).count()
         milestone_statistics['up_to_date'] = \
             RecipeUpstream.get_recipes_up_to_date(recipe_upstream_history).count()
         milestone_statistics['not_updated'] = \
Signature · 1 line
1.9.1