summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--schema.sql10
-rw-r--r--server.js3
-rw-r--r--views/head.pug2
-rw-r--r--views/tm_list.pug20
4 files changed, 15 insertions, 20 deletions
diff --git a/schema.sql b/schema.sql
index 0ee91e2..e945916 100644
--- a/schema.sql
+++ b/schema.sql
@@ -636,9 +636,12 @@ drop view if exists tm_pool_active_view;
create view tm_pool_active_view as
select
tm_pools.*,
+ tm_seeds.title_id,
+ tm_seeds.seed_name,
sum(status > 1) || ' / ' || count(1) as status
from
tm_pools
+ join tm_seeds using(seed_id)
left join tm_rounds using(pool_id)
left join games using(game_id)
where
@@ -646,16 +649,19 @@ create view tm_pool_active_view as
group by
pool_id
order by
- pool_name
+ seed_name, level, pool_id
;
drop view if exists tm_pool_finished_view;
create view tm_pool_finished_view as
select
tm_pools.*,
+ tm_seeds.title_id,
+ tm_seeds.seed_name,
group_concat(name) as status
from
tm_pools
+ join tm_seeds using(seed_id)
left join tm_winners using(pool_id)
left join users using(user_id)
where
@@ -663,7 +669,7 @@ create view tm_pool_finished_view as
group by
pool_id
order by
- pool_name
+ seed_name, level, pool_id
;
drop view if exists tm_pool_view;
diff --git a/server.js b/server.js
index b9bc612..ce2dd38 100644
--- a/server.js
+++ b/server.js
@@ -2961,7 +2961,8 @@ app.get("/tm/list", function (req, res) {
let seeds = TM_SEED_LIST_ALL.all(req.user ? req.user.user_id : 0)
let seeds_by_title = object_group_by(seeds, "title_id")
let active_pools = TM_POOL_LIST_ACTIVE.all()
- res.render("tm_list.pug", { user: req.user, seeds, seeds_by_title, active_pools })
+ let pools_by_seed = object_group_by(active_pools, "seed_name")
+ res.render("tm_list.pug", { user: req.user, seeds, seeds_by_title, active_pools, pools_by_seed })
})
app.get("/tm/seed/:seed_name", function (req, res) {
diff --git a/views/head.pug b/views/head.pug
index c3689c0..3792429 100644
--- a/views/head.pug
+++ b/views/head.pug
@@ -166,7 +166,7 @@ mixin poollist(list, title, icon)
if title
thead
tr
- th= title
+ th!= title
td= icon
tbody
each pool in list
diff --git a/views/tm_list.pug b/views/tm_list.pug
index 4f7c147..bc7fd83 100644
--- a/views/tm_list.pug
+++ b/views/tm_list.pug
@@ -11,20 +11,8 @@ html
p See <a href="/docs/tournaments.html">tournament information</a>.
- if 0
- dl
- each seeds, title_id in seeds_by_title
- dt= TITLE_NAME[title_id]
- each seed in seeds
- dd
- a(href="/tm/seed/" + seed.seed_name)= seed.seed_name
- | (#{seed.queue_size}/#{seed.pool_size})
- if user && seed.is_queued
- | &#x1f3ab;
- if 0
- each seeds, title_id in seeds_by_title
- +seedlist(seeds, TITLE_NAME[title_id])
- if 1
- +seedlist(seeds, "Mini Cup")
+ +seedlist(seeds, "Mini Cup")
- +poollist(active_pools, "Active")
+ h2 Active
+ each pools, seed_name in pools_by_seed
+ +poollist(pools, `<a href="/tm/seed/${seed_name}">${seed_name}</a>`)