Skip to content

Commit

Permalink
site: player: Fix teams not being sorted
Browse files Browse the repository at this point in the history
We never actually used the order clause for sorting teams. Fix this, and
make sure the default order puts more-recent teams first.

Fixes: 6ff791d ("site: player: Add separate teams page")
Signed-off-by: Sean Anderson <[email protected]>
  • Loading branch information
Forty-Bot committed Nov 24, 2023
1 parent e576215 commit a110415
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions trends/site/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def get_logs(c, playerid, filters, duplicates=True, order_clause="logid DESC", l
})
return logs

def get_teams(c, filters, order_clause="upper(rostered)", limit=10, offset=0):
def get_teams(c, filters, order_clause="upper(rostered) DESC", limit=10, offset=0):
inner_clauses = get_filter_clauses(filters, 'league', date_range='rostered')
outer_clauses = get_filter_clauses(filters, 'formatid')

Expand Down Expand Up @@ -188,7 +188,7 @@ def get_teams(c, filters, order_clause="upper(rostered)", limit=10, offset=0):
LEFT JOIN div_name USING (div_nameid)
WHERE r = 1
{}
ORDER BY {} NULLS FIRST, lower(rostered) ASC
ORDER BY {}
LIMIT %(limit)s OFFSET %(offset)s;""".format(inner_clauses, outer_clauses, order_clause),
{ 'playerid': flask.g.playerid, 'limit': limit, 'offset': offset, **filters })
return teams.fetchall()
Expand Down

0 comments on commit a110415

Please sign in to comment.