diff options
author | rubenwardy <rw@rubenwardy.com> | 2020-07-09 01:26:01 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2020-07-09 01:26:01 +0100 |
commit | 9d033acffff319e4f38b98a09ff2519f3f36dc88 (patch) | |
tree | e2a6ca7bf1fd9c9d97340f8c9d1e90f569729eef /app/tasks | |
parent | 2617c53abfc3b1a1af10a88794e17bb88affd61d (diff) | |
download | cheatdb-9d033acffff319e4f38b98a09ff2519f3f36dc88.tar.xz |
Separate rolling average downloads from score
Diffstat (limited to 'app/tasks')
-rw-r--r-- | app/tasks/pkgtasks.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/tasks/pkgtasks.py b/app/tasks/pkgtasks.py index c864ad0..639f61e 100644 --- a/app/tasks/pkgtasks.py +++ b/app/tasks/pkgtasks.py @@ -20,5 +20,10 @@ from app.tasks import celery @celery.task() def updatePackageScores(): - Package.query.update({ "score": Package.score * 0.95 }) + Package.query.update({ "score_downloads": Package.score_downloads * 0.95 }) + db.session.commit() + + for package in Package.query.all(): + package.recalcScore() + db.session.commit() |