views.py: Fix version in current milestone

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@linux.intel.com>
This commit is contained in:
Mariano Lopez 2015-07-01 14:08:09 -05:00 committed by Paul Eggleton
parent faafae13fa
commit 034bf57f71
2 changed files with 19 additions and 4 deletions

View File

@ -429,6 +429,13 @@ class Raw():
return stats 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 @staticmethod
def get_reupg_by_date(date): def get_reupg_by_date(date):
cur = connection.cursor() cur = connection.cursor()

View File

@ -121,10 +121,18 @@ def _get_recipe_list(milestone):
maintainers_dict_all = {} maintainers_dict_all = {}
current_date = date.today() current_date = date.today()
recipes = Raw.get_reupg_by_date( # If the is the curent milestone take the data recipes table
milestone.end_date) # otherwise take it from recipe upgrade
for recipe in recipes: if current_date >= milestone.start_date and \
recipes_ids.append(recipe['id']) 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: if recipe_upstream_history:
recipe_upstream_all = Raw.get_reup_by_recipes_and_date( recipe_upstream_all = Raw.get_reup_by_recipes_and_date(