stop using nullslast rDrama/rDrama#102

master
Aevann 2023-01-28 10:25:19 +02:00
parent a0f4697edf
commit 3b4211e8e1
5 changed files with 7 additions and 8 deletions

View File

@ -2,7 +2,6 @@ import time
from urllib.parse import quote, urlencode from urllib.parse import quote, urlencode
from math import floor from math import floor
from sqlalchemy import nullslast
from sqlalchemy.exc import IntegrityError from sqlalchemy.exc import IntegrityError
from psycopg2.errors import UniqueViolation from psycopg2.errors import UniqueViolation

View File

@ -1,7 +1,7 @@
import os import os
from shutil import copyfile from shutil import copyfile
from sqlalchemy import func, nullslast from sqlalchemy import func
from files.helpers.media import process_files from files.helpers.media import process_files
import files.helpers.stats as statshelper import files.helpers.stats as statshelper

View File

@ -1,5 +1,3 @@
from sqlalchemy import nullslast
from files.classes import * from files.classes import *
from files.helpers.alerts import * from files.helpers.alerts import *
from files.helpers.get import * from files.helpers.get import *
@ -201,7 +199,7 @@ def sub_exilees(v:User, sub):
abort(403) abort(403)
users = g.db.query(User, Exile).join(Exile, Exile.user_id==User.id) \ users = g.db.query(User, Exile).join(Exile, Exile.user_id==User.id) \
.filter_by(sub=sub.name) \ .filter_by(sub=sub.name) \
.order_by(nullslast(Exile.created_utc.desc()), User.username).all() .order_by(Exile.created_utc.desc(), User.username).all()
return render_template("sub/exilees.html", v=v, sub=sub, users=users) return render_template("sub/exilees.html", v=v, sub=sub, users=users)
@ -215,7 +213,7 @@ def sub_blockers(v:User, sub):
abort(403) abort(403)
users = g.db.query(User, SubBlock).join(SubBlock) \ users = g.db.query(User, SubBlock).join(SubBlock) \
.filter_by(sub=sub.name) \ .filter_by(sub=sub.name) \
.order_by(nullslast(SubBlock.created_utc.desc()), User.username).all() .order_by(SubBlock.created_utc.desc(), User.username).all()
return render_template("sub/blockers.html", return render_template("sub/blockers.html",
v=v, sub=sub, users=users, verb="blocking") v=v, sub=sub, users=users, verb="blocking")
@ -230,7 +228,7 @@ def sub_followers(v:User, sub):
abort(403) abort(403)
users = g.db.query(User, SubSubscription).join(SubSubscription) \ users = g.db.query(User, SubSubscription).join(SubSubscription) \
.filter_by(sub=sub.name) \ .filter_by(sub=sub.name) \
.order_by(nullslast(SubSubscription.created_utc.desc()), User.username).all() .order_by(SubSubscription.created_utc.desc(), User.username).all()
return render_template("sub/blockers.html", return render_template("sub/blockers.html",
v=v, sub=sub, users=users, verb="following") v=v, sub=sub, users=users, verb="following")

View File

@ -7,7 +7,6 @@ from typing import Literal
import gevent import gevent
import qrcode import qrcode
from sqlalchemy import nullslast
from sqlalchemy.orm import aliased from sqlalchemy.orm import aliased
from files.classes import * from files.classes import *

View File

@ -0,0 +1,3 @@
update sub_blocks set created_utc=0 where created_utc is null;
update exiles set created_utc=0 where created_utc is null;
update sub_subscriptions set created_utc=0 where created_utc is null;