rrs/views: Fix mismatch in summary and recipe list

This fixes the issue with the mismatch in the
statistics bar and the recipe list. The mismatch
is caused by the gcc-source recipe, because every
version of the recipe is counted in Upstream History
but not in Recipe Upgrade.

Also added the TODO.rrs to track bugs and issues with
rrs.

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
This commit is contained in:
Mariano Lopez 2015-08-28 11:47:41 -05:00 committed by Paul Eggleton
parent 5e8eeaa8ac
commit ef32d52b29
3 changed files with 46 additions and 9 deletions

4
TODO.rrs Normal file
View File

@ -0,0 +1,4 @@
TODO:
Bugs:
- gcc-source recipe has his own recipes per version. This is triggered in gcc-source.inc

View File

@ -428,6 +428,41 @@ class Raw():
return stats
@staticmethod
def get_reup_statistics(date, date_id):
""" Special case to get recipes statistics removing gcc-source duplicates """
recipes = []
updated = 0
not_updated = 0
cant = 0
unknown = 0
all_recipes = Raw.get_reupg_by_date(date)
for re in all_recipes:
recipes.append(re["id"])
if date_id:
recipes = str(recipes).strip('[]')
qry = """SELECT id, status, no_update_reason
FROM rrs_RecipeUpstream"""
qry += "\nWHERE history_id = '%s'" % str(date_id.id)
qry += "\nAND recipe_id IN (%s);" % recipes
cur = connection.cursor()
cur.execute(qry)
for re in Raw.dictfetchall(cur):
if re["status"] == "Y":
updated += 1
elif re["status"] == "N" and re["no_update_reason"] == "":
not_updated += 1
elif re["status"] == "N":
cant += 1
# We count downgrade as unknown
else:
unknown += 1
return (updated, not_updated, cant, unknown)
@staticmethod
def get_reup_by_recipes_and_date(recipes_id, date_id=None):
""" Get Recipe Upstream based on Recipes and Recipe Upstream History """

View File

@ -47,16 +47,14 @@ def _get_milestone_statistics(milestone, maintainer_name=None):
)
if maintainer_name is None:
t_updated, t_not_updated, t_cant, t_unknown = \
Raw.get_reup_statistics(milestone.end_date, recipe_upstream_history)
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'] = \
RecipeUpstream.get_recipes_not_updated(recipe_upstream_history).count()
milestone_statistics['cant_be_updated'] = \
RecipeUpstream.get_recipes_cant_be_updated(recipe_upstream_history).count()
milestone_statistics['unknown'] = \
RecipeUpstream.get_recipes_unknown(recipe_upstream_history).count()
t_updated + t_not_updated + t_cant + t_unknown
milestone_statistics['up_to_date'] = t_updated
milestone_statistics['not_updated'] = t_not_updated
milestone_statistics['cant_be_updated'] = t_cant
milestone_statistics['unknown'] = t_unknown
milestone_statistics['percentage'] = 0
milestone_statistics['all_upgraded'] = 0
milestone_statistics['all_not_upgraded'] = 0