[odrs-web] Actually port the cron script over to use component



commit 505d898d7b9664759771c58962c8c095b19a1690
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jul 4 12:24:55 2019 +0100

    Actually port the cron script over to use component

 app_data/cron.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/app_data/cron.py b/app_data/cron.py
index 7bab12c..084b153 100755
--- a/app_data/cron.py
+++ b/app_data/cron.py
@@ -14,7 +14,7 @@ import csv
 
 from odrs import db
 
-from odrs.models import Review, Taboo
+from odrs.models import Review, Taboo, Component
 from odrs.util import _get_rating_for_app_id, _get_taboos_for_locale
 
 def _auto_delete(days=31):
@@ -36,9 +36,8 @@ def _auto_delete(days=31):
 def _regenerate_ratings(fn):
     item = {}
 
-    app_ids = [res[0] for res in db.session.query(Review.app_id).\
-                       order_by(Review.app_id.asc()).\
-                       distinct(Review.app_id).all()]
+    app_ids = [res[0] for res in db.session.query(Component.app_id).\
+                                    order_by(Component.app_id.asc()).all()]
     for app_id in app_ids:
         ratings = _get_rating_for_app_id(app_id, 2)
         if len(ratings) == 0:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]