From 9d033acffff319e4f38b98a09ff2519f3f36dc88 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 9 Jul 2020 01:26:01 +0100 Subject: Separate rolling average downloads from score --- app/tasks/pkgtasks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/tasks/pkgtasks.py') 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() -- cgit v1.2.3