home: some stats
This commit is contained in:
parent
a33ef03607
commit
662e5a34e9
2 changed files with 42 additions and 2 deletions
|
@ -14,7 +14,7 @@ portal = Blueprint("portal", __name__, template_folder="templates", static_folde
|
|||
@portal.app_template_filter("mirror_expiry")
|
||||
def calculate_mirror_expiry(s):
|
||||
expiry = s + timedelta(days=3)
|
||||
countdown = expiry - datetime.utcnow()
|
||||
countdown = expiry - datetime.now(timezone.utc)
|
||||
if countdown.days == 0:
|
||||
return f"{countdown.seconds // 3600} hours"
|
||||
return f"{countdown.days} days"
|
||||
|
@ -29,7 +29,12 @@ def format_datetime(s):
|
|||
|
||||
@portal.route("/")
|
||||
def portal_home():
|
||||
return render_template("home.html.j2", section="home")
|
||||
groups = Group.query.order_by(Group.group_name).all()
|
||||
now = datetime.now(timezone.utc)
|
||||
last24 = len(Proxy.query.filter(Proxy.deprecated > (now - timedelta(days=1))).all())
|
||||
last72 = len(Proxy.query.filter(Proxy.deprecated > (now - timedelta(days=3))).all())
|
||||
lastweek = len(Proxy.query.filter(Proxy.deprecated > (now - timedelta(days=7))).all())
|
||||
return render_template("home.html.j2", section="home", groups=groups, last24=last24, last72=last72, lastweek=lastweek)
|
||||
|
||||
|
||||
@portal.route("/groups")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue