Skip to content

Commit

Permalink
fix: small db-specific fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alanzhu0 committed Sep 25, 2024
1 parent d579204 commit f880706
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion othello/apps/games/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def latest(self, **kwargs: Any) -> "models.query.QuerySet[Submission]":
"""
Returns a set of all the latest submissions for all users
"""
return self.filter(**kwargs).distinct("user")
return self.filter(**kwargs).distinct("user").order_by("user", "-created_at")


class Submission(models.Model):
Expand Down
3 changes: 1 addition & 2 deletions othello/static/js/games/design.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ function playerSort(el) {
username = el.text.match(/\(([^)]+)\)/)[1];
}
// sort descending by year, if it is part of the username, and then alphabetically
// if username begins with year, sort by year, then alphabetically
if(username.match(/^\d{4}/)){
// first four numbers are year
let year = username.substring(0, 4);
Expand Down Expand Up @@ -73,8 +72,8 @@ window.onload = function () {
}
});
$("#id_white").selectize({
maxItems: 1,
options: players,
maxItems: 1,
onChange: function (val) {
showYourselfHelp(val, "#white-help");
},
Expand Down

0 comments on commit f880706

Please sign in to comment.