diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2015-07-14 18:22:14 -0500 |
---|---|---|
committer | Paul Eggleton <paul.eggleton@linux.intel.com> | 2018-05-04 23:57:52 +1200 |
commit | b2e04c0a9e118287c3c781036a82cb35b739cf35 (patch) | |
tree | d3d434fd30ada856c2094eef2f0c626597c7eca3 | |
parent | 4936eaa65a1f9774de72d45a9d51b4bb7fd1ce57 (diff) | |
download | openembedded-core-contrib-b2e04c0a9e118287c3c781036a82cb35b739cf35.tar.gz |
rrs: Fix last updated.
Don't conditional last updated to upstream status.
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
-rw-r--r-- | rrs/models.py | 12 | ||||
-rw-r--r-- | rrs/views.py | 25 |
2 files changed, 15 insertions, 22 deletions
diff --git a/rrs/models.py b/rrs/models.py index 144ca16d8a..abc9d5b3be 100644 --- a/rrs/models.py +++ b/rrs/models.py @@ -449,15 +449,9 @@ class Raw(): def get_reup_by_last_updated(date): """ Get last time the Recipes were upgraded """ cur = connection.cursor() - cur.execute("""SELECT te.recipe_id, te.status, te.date, te.rownum FROM( - SELECT recipe_id, status, date, ROW_NUMBER() OVER( - PARTITION BY recipe_id - ORDER BY date DESC - ) AS rownum - FROM rrs_RecipeUpstream - WHERE status = 'Y' - AND date <= %s) AS te - WHERE te.rownum = 1; + cur.execute("""SELECT recipe_id, MAX(commit_date) AS date + FROM rrs_recipeupgrade + GROUP BY recipe_id; """, [date]) return Raw.dictfetchall(cur) diff --git a/rrs/views.py b/rrs/views.py index 7fce084c81..ee68254e80 100644 --- a/rrs/views.py +++ b/rrs/views.py @@ -145,22 +145,23 @@ def _get_recipe_list(milestone): recipes[i]['version'] = re['pv'] recipes_ids.append(re['id']) - if recipes and recipe_upstream_history: - recipe_upstream_all = Raw.get_reup_by_recipes_and_date( - recipes_ids, recipe_upstream_history.id) + if recipes: recipe_last_updated = Raw.get_reup_by_last_updated( milestone.end_date) - maintainers_all = Raw.get_ma_by_recipes_and_date( - recipes_ids, recipe_maintainer_history[0]) - for reup in recipe_upstream_all: - recipe_upstream_dict_all[reup['recipe_id']] = reup for rela in recipe_last_updated: recipe_last_updated_dict_all[rela['recipe_id']] = rela - for ma in maintainers_all: - maintainers_dict_all[ma['recipe_id']] = ma['name'] - else: - recipe_upstream_all = None + if recipe_upstream_history: + recipe_upstream_all = Raw.get_reup_by_recipes_and_date( + recipes_ids, recipe_upstream_history.id) + for reup in recipe_upstream_all: + recipe_upstream_dict_all[reup['recipe_id']] = reup + + if recipe_maintainer_history: + maintainers_all = Raw.get_ma_by_recipes_and_date( + recipes_ids, recipe_maintainer_history[0]) + for ma in maintainers_all: + maintainers_dict_all[ma['recipe_id']] = ma['name'] for recipe in recipes: upstream_version = '' @@ -201,8 +202,6 @@ def _get_recipe_list(milestone): if recipe_last_updated: recipe_date = recipe_last_updated['date'] outdated = recipe_date.date().isoformat() - else: - outdated = 'Unknown' else: outdated = 'Up-to-date' |