asc is default so u dont need to specify it
parent
fbadbed672
commit
8b08957e4c
|
@ -81,7 +81,7 @@ class Leaderboard:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def rank_filtered_rank_label_by_asc_sum(cls, criteria):
|
def rank_filtered_rank_label_by_asc_sum(cls, criteria):
|
||||||
return func.rank().over(order_by=func.sum(criteria).asc()).label("rank")
|
return func.rank().over(order_by=func.sum(criteria)).label("rank")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def rank_filtered_rank_label_by_desc_avg(cls, criteria1, criteria2):
|
def rank_filtered_rank_label_by_desc_avg(cls, criteria1, criteria2):
|
||||||
|
|
|
@ -42,10 +42,10 @@ def get_game_leaderboard(game):
|
||||||
CasinoGame).join(User).order_by(CasinoGame.winnings.desc()).filter(CasinoGame.kind == game, CasinoGame.created_utc > timestamp_24h_ago).limit(1).one_or_none()
|
CasinoGame).join(User).order_by(CasinoGame.winnings.desc()).filter(CasinoGame.kind == game, CasinoGame.created_utc > timestamp_24h_ago).limit(1).one_or_none()
|
||||||
|
|
||||||
biggest_loss_all_time = g.db.query(CasinoGame.user_id, User.username, CasinoGame.currency, CasinoGame.winnings).select_from(
|
biggest_loss_all_time = g.db.query(CasinoGame.user_id, User.username, CasinoGame.currency, CasinoGame.winnings).select_from(
|
||||||
CasinoGame).join(User).order_by(CasinoGame.winnings.asc()).filter(CasinoGame.kind == game, CasinoGame.created_utc > timestamp_all_time).limit(1).one_or_none()
|
CasinoGame).join(User).order_by(CasinoGame.winnings).filter(CasinoGame.kind == game, CasinoGame.created_utc > timestamp_all_time).limit(1).one_or_none()
|
||||||
|
|
||||||
biggest_loss_last_24h = g.db.query(CasinoGame.user_id, User.username, CasinoGame.currency, CasinoGame.winnings).select_from(
|
biggest_loss_last_24h = g.db.query(CasinoGame.user_id, User.username, CasinoGame.currency, CasinoGame.winnings).select_from(
|
||||||
CasinoGame).join(User).order_by(CasinoGame.winnings.asc()).filter(CasinoGame.kind == game, CasinoGame.created_utc > timestamp_24h_ago).limit(1).one_or_none()
|
CasinoGame).join(User).order_by(CasinoGame.winnings).filter(CasinoGame.kind == game, CasinoGame.created_utc > timestamp_24h_ago).limit(1).one_or_none()
|
||||||
|
|
||||||
if not biggest_win_all_time:
|
if not biggest_win_all_time:
|
||||||
biggest_win_all_time = [None, None, None, 0]
|
biggest_win_all_time = [None, None, None, 0]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import os
|
import os
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
|
|
||||||
from sqlalchemy import func, asc, text
|
from sqlalchemy import func, text
|
||||||
from files.helpers.media import *
|
from files.helpers.media import *
|
||||||
|
|
||||||
import files.helpers.stats as statshelper
|
import files.helpers.stats as statshelper
|
||||||
|
@ -361,9 +361,9 @@ def blocks(v):
|
||||||
total = blocks.count()
|
total = blocks.count()
|
||||||
|
|
||||||
if sort == "user":
|
if sort == "user":
|
||||||
key = asc(text('users_1_username'))
|
key = text('users_1_username')
|
||||||
elif sort == "target":
|
elif sort == "target":
|
||||||
key = asc(text('users_2_username'))
|
key = text('users_2_username')
|
||||||
else:
|
else:
|
||||||
sort = "time"
|
sort = "time"
|
||||||
key = UserBlock.created_utc.desc()
|
key = UserBlock.created_utc.desc()
|
||||||
|
|
Loading…
Reference in New Issue