diff --git a/app/templates/index.html b/app/templates/index.html index 210cc84..e11b3c8 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -51,7 +51,7 @@ Welcome
- CDB has {{ count }} packages available to download. + CDB has {{ count }} packages, with a total of {{ downloads }} downloads.
diff --git a/app/views/__init__.py b/app/views/__init__.py index 303ed2a..c99ca03 100644 --- a/app/views/__init__.py +++ b/app/views/__init__.py @@ -22,6 +22,7 @@ from app.models import * import flask_menu as menu from werkzeug.contrib.cache import SimpleCache from urllib.parse import urlparse +from sqlalchemy.sql.expression import func cache = SimpleCache() @app.template_filter() @@ -53,7 +54,8 @@ def home_page(): pop_mod = query.filter_by(type=PackageType.MOD).order_by(db.desc(Package.score)).limit(8).all() pop_gam = query.filter_by(type=PackageType.GAME).order_by(db.desc(Package.score)).limit(4).all() pop_txp = query.filter_by(type=PackageType.TXP).order_by(db.desc(Package.score)).limit(4).all() - return render_template("index.html", count=count, \ + downloads = db.session.query(func.sum(PackageRelease.downloads)).first()[0] + return render_template("index.html", count=count, downloads=downloads, \ new=new, pop_mod=pop_mod, pop_txp=pop_txp, pop_gam=pop_gam) from . import users, packages, meta, threads, api