aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2015-08-17 10:30:12 -0500
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-05-04 23:57:52 +1200
commit6aa369757cdd5c3d70ea7ebc352799ae60887007 (patch)
tree3fa6c899a53efbe1d4662704ec74b611e63c8630
parent66c0b28982c89bfa1610fbc1b8efe2195a62d7b8 (diff)
downloadopenembedded-core-contrib-6aa369757cdd5c3d70ea7ebc352799ae60887007.tar.gz
rrs/views.py: Added percentages for navbar
This adds the percentage for all the recipes types (up-to-date, not updated, unknown, can't be updated) so it can be displayed in the navbar. This also adds the number of the recipes not updated at the begining of the period and number of recipes updated in the period. The changes in the frontend are still missing, this just adds the functionality. [YOCTO #8020] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
-rw-r--r--rrs/views.py71
1 files changed, 55 insertions, 16 deletions
diff --git a/rrs/views.py b/rrs/views.py
index e446c0dbf6..01f14f5640 100644
--- a/rrs/views.py
+++ b/rrs/views.py
@@ -47,22 +47,8 @@ def _get_milestone_statistics(milestone, maintainer_name=None):
)
if maintainer_name is None:
- if recipe_upstream_history_first:
- recipes_not_upgraded = \
- Raw.get_reup_by_date(recipe_upstream_history_first.id)
- if recipes_not_upgraded:
- recipes_upgraded = \
- Raw.get_reupg_by_dates_and_recipes(
- milestone.start_date, milestone.end_date, recipes_not_upgraded)
- milestone_statistics['all'] = \
- float(len(recipes_upgraded))/float(len(recipes_not_upgraded))
- else:
- milestone_statistics['all'] = 0
- else:
- milestone_statistics['all'] = 0
-
- milestone_statistics['percentage'] = "%.0f" % \
- (float(milestone_statistics['all']) * 100.0)
+ 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'] = \
@@ -71,6 +57,39 @@ def _get_milestone_statistics(milestone, maintainer_name=None):
RecipeUpstream.get_recipes_cant_be_updated(recipe_upstream_history).count()
milestone_statistics['unknown'] = \
RecipeUpstream.get_recipes_unknown(recipe_upstream_history).count()
+ milestone_statistics['percentage'] = 0
+ milestone_statistics['all_upgraded'] = 0
+ milestone_statistics['all_not_upgraded'] = 0
+ milestone_statistics['percentage_up_to_date'] = 0
+ milestone_statistics['percentage_not_updated'] = 0
+ milestone_statistics['percentage_cant_be_updated'] = 0
+ milestone_statistics['percentage_unknown'] = 0
+
+ if recipe_upstream_history_first:
+ recipes_not_upgraded = \
+ Raw.get_reup_by_date(recipe_upstream_history_first.id)
+ if recipes_not_upgraded:
+ recipes_upgraded = \
+ Raw.get_reupg_by_dates_and_recipes(
+ milestone.start_date, milestone.end_date, recipes_not_upgraded)
+ milestone_statistics['percentage'] = "%.0f" % \
+ ((float(len(recipes_upgraded)) * 100.0)
+ /float(len(recipes_not_upgraded)))
+ milestone_statistics['all_upgraded'] = len(recipes_upgraded)
+ milestone_statistics['all_not_upgraded'] = len(recipes_not_upgraded)
+ milestone_statistics['percentage_up_to_date'] = "%.0f" % \
+ (float(milestone_statistics['up_to_date']) * 100.0 \
+ /float(milestone_statistics['all']))
+ milestone_statistics['percentage_not_updated'] = "%.0f" % \
+ (float(milestone_statistics['not_updated']) * 100.0 \
+ /float(milestone_statistics['all']))
+ milestone_statistics['percentage_cant_be_updated'] = "%.0f" % \
+ (float(milestone_statistics['cant_be_updated']) * 100.0 \
+ /float(milestone_statistics['all']))
+ milestone_statistics['percentage_unknown'] = "%.0f" % \
+ (float(milestone_statistics['unknown']) * 100.0
+ /float(milestone_statistics['all']))
+
else:
recipe_maintainer_history = Raw.get_remahi_by_end_date(
milestone.end_date)
@@ -259,10 +278,20 @@ class RecipeListView(ListView):
context['all_milestones'] = Milestone.get_by_release_name(self.release_name)
context['recipes_percentage'] = self.milestone_statistics['percentage']
+ context['recipes_all_upgraded'] = self.milestone_statistics['all_upgraded']
+ context['recipes_all_not_upgraded'] = self.milestone_statistics['all_not_upgraded']
context['recipes_up_to_date'] = self.milestone_statistics['up_to_date']
context['recipes_not_updated'] = self.milestone_statistics['not_updated']
context['recipes_cant_be_updated'] = self.milestone_statistics['cant_be_updated']
context['recipes_unknown'] = self.milestone_statistics['unknown']
+ context['recipes_percentage_up_to_date'] = \
+ self.milestone_statistics['percentage_up_to_date']
+ context['recipes_percentage_not_updated'] = \
+ self.milestone_statistics['percentage_not_updated']
+ context['recipes_percentage_cant_be_updated'] = \
+ self.milestone_statistics['percentage_cant_be_updated']
+ context['recipes_percentage_unknown'] = \
+ self.milestone_statistics['percentage_unknown']
context['recipe_list_count'] = self.recipe_list_count
@@ -519,10 +548,20 @@ class MaintainerListView(ListView):
context['all_milestones'] = Milestone.get_by_release_name(self.release_name)
context['recipes_percentage'] = self.milestone_statistics['percentage']
+ context['recipes_all_upgraded'] = self.milestone_statistics['all_upgraded']
+ context['recipes_all_not_upgraded'] = self.milestone_statistics['all_not_upgraded']
context['recipes_up_to_date'] = self.milestone_statistics['up_to_date']
context['recipes_not_updated'] = self.milestone_statistics['not_updated']
context['recipes_cant_be_updated'] = self.milestone_statistics['cant_be_updated']
context['recipes_unknown'] = self.milestone_statistics['unknown']
+ context['recipes_percentage_up_to_date'] = \
+ self.milestone_statistics['percentage_up_to_date']
+ context['recipes_percentage_not_updated'] = \
+ self.milestone_statistics['percentage_not_updated']
+ context['recipes_percentage_cant_be_updated'] = \
+ self.milestone_statistics['percentage_cant_be_updated']
+ context['recipes_percentage_unknown'] = \
+ self.milestone_statistics['percentage_unknown']
context['maintainer_count'] = self.maintainer_count
context['intervals'] = self.intervals