[yocto] [PATCH] views.py: Fix version in current milestone

mariano.lopez at linux.intel.com mariano.lopez at linux.intel.com
Wed Jul 1 12:08:09 PDT 2015


From: Mariano Lopez <mariano.lopez at linux.intel.com>

Fixed the version displayed in current milestone.
Before the data was obtained from recipe upgrad table
and this allows to fetch the data from the recipe table.

Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
---
 rrs/models.py |  7 +++++++
 rrs/views.py  | 16 ++++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/rrs/models.py b/rrs/models.py
index 320670c..f0d4ed3 100644
--- a/rrs/models.py
+++ b/rrs/models.py
@@ -430,6 +430,13 @@ class Raw():
         return stats
 
     @staticmethod
+    def get_re_all():
+        cur = connection.cursor()
+        cur.execute("""SELECT id, pn, pv, summary
+                FROM layerindex_recipe""")
+        return Raw.dictfetchall(cur)
+
+    @staticmethod
     def get_reupg_by_date(date):
         cur = connection.cursor()
         cur.execute("""SELECT re.id, re.pn, re.summary, te.version, rownum FROM (
diff --git a/rrs/views.py b/rrs/views.py
index e2aa1ce..4a1e9bb 100644
--- a/rrs/views.py
+++ b/rrs/views.py
@@ -119,10 +119,18 @@ def _get_recipe_list(milestone):
     maintainers_dict_all = {}
     current_date = date.today()
 
-    recipes = Raw.get_reupg_by_date(
-            milestone.end_date)
-    for recipe in recipes:
-        recipes_ids.append(recipe['id'])
+    # If the is the curent milestone take the data recipes table
+    # otherwise take it from recipe upgrade
+    if current_date >= milestone.start_date and \
+            current_date <= milestone.end_date:
+        recipes = Raw.get_re_all()
+    else:
+        recipes = Raw.get_reupg_by_date(milestone.end_date)
+
+    for i,re in enumerate(recipes):
+        if re.has_key('pv'):
+            recipes[i]['version'] = re['pv']
+        recipes_ids.append(re['id'])
 
     if recipe_upstream_history:
         recipe_upstream_all = Raw.get_reup_by_recipes_and_date(
-- 
1.9.1




More information about the yocto mailing list