]> git.lizzy.rs Git - cheatdb.git/blob - app/tasks/pkgtasks.py
Replace "Content DB" with "ContentDB"
[cheatdb.git] / app / tasks / pkgtasks.py
1 # ContentDB
2 # Copyright (C) 2018  rubenwardy
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
16
17
18 from app.models import Package, db
19 from app.tasks import celery
20
21 @celery.task()
22 def updatePackageScores():
23         Package.query.update({ "score_downloads": Package.score_downloads * 0.95 })
24         db.session.commit()
25
26         for package in Package.query.all():
27                 package.recalcScore()
28
29         db.session.commit()