rrs: Add support to display version by Milestone based on RecipeUpgrade's

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
This commit is contained in:
Aníbal Limón 2015-02-15 13:53:52 -06:00 committed by Paul Eggleton
parent 22af5216de
commit 446220e8c9
2 changed files with 17 additions and 1 deletions

View File

@ -255,6 +255,16 @@ class RecipeUpgrade(models.Model):
author_date = models.DateTimeField()
commit_date = models.DateTimeField()
@staticmethod
def get_by_recipe_and_date(recipe, current_date):
rup_qry = RecipeUpgrade.objects.filter(recipe = recipe,
commit_date__lte = current_date).order_by('commit_date')
if rup_qry:
return rup_qry[0]
else:
return None
def short_sha1(self):
return self.sha1[0:6]

View File

@ -137,7 +137,13 @@ class RecipeListView(ListView):
current_date <= milestone.end_date:
version = recipe.pv
else:
version = '' # Implement recipe version history
version = ''
rup = RecipeUpgrade.get_by_recipe_and_date(recipe,
milestone.end_date)
if not rup is None:
version = rup.version
recipe_upstream = RecipeUpstream.get_by_recipe_and_history(
recipe, recipe_upstream_history)