mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-10 01:23:48 +01:00
Add download counter to home page
This commit is contained in:
parent
2844773e4d
commit
7810bb54e0
@ -51,7 +51,7 @@ Welcome
|
||||
|
||||
<div class="text-center">
|
||||
<small>
|
||||
CDB has {{ count }} packages available to download.
|
||||
CDB has {{ count }} packages, with a total of {{ downloads }} downloads.
|
||||
</small>
|
||||
</div>
|
||||
<!-- </main> -->
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user