aboutsummaryrefslogtreecommitdiff
path: root/app/blueprints
diff options
context:
space:
mode:
Diffstat (limited to 'app/blueprints')
-rw-r--r--app/blueprints/homepage/__init__.py2
-rw-r--r--app/blueprints/metrics/__init__.py3
-rw-r--r--app/blueprints/packages/releases.py1
3 files changed, 3 insertions, 3 deletions
diff --git a/app/blueprints/homepage/__init__.py b/app/blueprints/homepage/__init__.py
index 5df612f..4f6d5eb 100644
--- a/app/blueprints/homepage/__init__.py
+++ b/app/blueprints/homepage/__init__.py
@@ -21,7 +21,7 @@ def home():
pop_mod = join(query.filter_by(type=PackageType.MOD).order_by(db.desc(Package.score))).limit(8).all()
pop_gam = join(query.filter_by(type=PackageType.GAME).order_by(db.desc(Package.score))).limit(4).all()
pop_txp = join(query.filter_by(type=PackageType.TXP).order_by(db.desc(Package.score))).limit(4).all()
- downloads_result = db.session.query(func.sum(PackageRelease.downloads)).one_or_none()
+ downloads_result = db.session.query(func.sum(Package.downloads)).one_or_none()
downloads = 0 if not downloads_result or not downloads_result[0] else downloads_result[0]
return render_template("index.html", count=count, downloads=downloads, \
new=new, pop_mod=pop_mod, pop_txp=pop_txp, pop_gam=pop_gam)
diff --git a/app/blueprints/metrics/__init__.py b/app/blueprints/metrics/__init__.py
index 70ea39d..4d3c3cf 100644
--- a/app/blueprints/metrics/__init__.py
+++ b/app/blueprints/metrics/__init__.py
@@ -42,8 +42,7 @@ def generate_metrics(full=False):
return ret + "\n"
-
- downloads_result = db.session.query(func.sum(PackageRelease.downloads)).one_or_none()
+ downloads_result = db.session.query(func.sum(Package.downloads)).one_or_none()
downloads = 0 if not downloads_result or not downloads_result[0] else downloads_result[0]
packages = Package.query.filter_by(approved=True, soft_deleted=False).count()
diff --git a/app/blueprints/packages/releases.py b/app/blueprints/packages/releases.py
index b3a2f83..8136521 100644
--- a/app/blueprints/packages/releases.py
+++ b/app/blueprints/packages/releases.py
@@ -140,6 +140,7 @@ def download_release(package, id):
})
Package.query.filter_by(id=package.id).update({
+ "downloads": Package.downloads + 1,
"score": Package.score + bonus
})