aboutsummaryrefslogtreecommitdiffstats
path: root/pysite
diff options
context:
space:
mode:
authorGravatar momothereal <[email protected]>2018-06-19 23:30:28 -0400
committerGravatar momothereal <[email protected]>2018-06-19 23:30:28 -0400
commitc7f13a187300dc9eb936aaa00843ce9ed7a547f5 (patch)
tree3ea77dddd0ac9c64b86458fdb122f98a1889c7bd /pysite
parentAdd GitLab button next to username (diff)
Cleanup team list querying, add tooltip to Gitlab user button
Diffstat (limited to 'pysite')
-rw-r--r--pysite/views/main/jams/teams_list.py (renamed from pysite/views/main/jams/team.py)25
1 files changed, 9 insertions, 16 deletions
diff --git a/pysite/views/main/jams/team.py b/pysite/views/main/jams/teams_list.py
index f266536d..ed4f0748 100644
--- a/pysite/views/main/jams/team.py
+++ b/pysite/views/main/jams/teams_list.py
@@ -1,3 +1,5 @@
+import rethinkdb
+
from pysite.base_route import RouteView
from pysite.mixins import DBMixin, OAuthMixin
@@ -22,25 +24,16 @@ class JamsTeamView(RouteView, DBMixin, OAuthMixin):
"gitlab_username":
self.db.query("code_jam_participants").filter({"id": user["user_id"]})
.coerce_to("array")[0]["gitlab_username"]
- }).coerce_to("array")
+ }).coerce_to("array"),
+ "jam":
+ self.db.query("code_jams").filter(
+ lambda jam: jam["teams"].contains(team["id"])
+ ).coerce_to("array")[0]
}
- )
+ ).order_by(rethinkdb.desc("jam.number"))
teams = self.db.run(query)
- entries = []
-
- for team in teams:
- # find the jam for this team
- query = self.db.query("code_jams").filter(
- lambda jam: jam["teams"].contains(team["id"])
- )
- jam = next(self.db.run(query))
- entries.append({
- "team": team,
- "jam": jam
- })
-
return self.render(
"main/jams/teams_list.html",
- entries=entries
+ teams=teams
)