From cd0b56440125e6646890d57917efe11ec6586a7f Mon Sep 17 00:00:00 2001 From: TLSM Date: Sat, 1 Oct 2022 18:27:51 -0400 Subject: [PATCH] Add 'added' column to /marseys. --- files/routes/static.py | 10 +++++++--- files/templates/marseys.html | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/files/routes/static.py b/files/routes/static.py index 0c78e15e8..9effd1d0c 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -4,7 +4,7 @@ from files.helpers.alerts import * from files.helpers.const import * from files.helpers.actions import * from files.classes.award import AWARDS -from sqlalchemy import func +from sqlalchemy import func, nullslast import os from files.classes.mod_logs import ACTIONTYPES, ACTIONTYPES2 from files.classes.badges import BadgeDef @@ -25,8 +25,12 @@ def marseys(v): if SITE == 'rdrama.net': marseys = g.db.query(Marsey, User).join(User, Marsey.author_id == User.id).filter(Marsey.submitter_id==None) sort = request.values.get("sort", "usage") - if sort == "usage": marseys = marseys.order_by(Marsey.count.desc(), User.username).all() - else: marseys = marseys.order_by(User.username, Marsey.count.desc()).all() + if sort == "usage": + marseys = marseys.order_by(Marsey.count.desc(), User.username).all() + elif sort == "added": + marseys = marseys.order_by(nullslast(Marsey.created_utc.desc()), User.username).all() + else: # implied sort == "author" + marseys = marseys.order_by(User.username, Marsey.count.desc()).all() original = os.listdir("/asset_submissions/marseys/original") for marsey, user in marseys: diff --git a/files/templates/marseys.html b/files/templates/marseys.html index d287603cb..e79c1b919 100644 --- a/files/templates/marseys.html +++ b/files/templates/marseys.html @@ -13,6 +13,7 @@ Usage {% if SITE == 'rdrama.net' %} Author + Added Original File {% endif %} @@ -26,6 +27,7 @@ :#{{marsey.name}}: {{marsey.count}} {% include "user_in_table.html" %} + {% if marsey.og %} {{marsey.og}}