From 34487c1b1920c6a52108a7ed7b390d4b08728ff9 Mon Sep 17 00:00:00 2001
From: Tor Andersson <tor@ccxvii.net>
Date: Tue, 23 Jul 2024 13:48:12 +0200
Subject: New join page!

* Remove explicit (and redundant) role=Observer parameter.
* Remove old /play/:id redirects.
* Show "private" badge on game boxes.
* Forbid leave/kick in public games.
* Allow "rewind" by owner in public games.
---
 schema.sql | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

(limited to 'schema.sql')

diff --git a/schema.sql b/schema.sql
index 9fe8a76..1d3641c 100644
--- a/schema.sql
+++ b/schema.sql
@@ -474,6 +474,18 @@ create view game_view as
 			on owner.user_id = games.owner_id
 	;
 
+drop view if exists game_view_public;
+create view game_view_public as
+	select
+		*
+	from
+		game_view
+	where
+		not is_private
+		and join_count > 0
+		and join_count = user_count
+	;
+
 drop view if exists player_view;
 create view player_view as
 	select
@@ -502,11 +514,13 @@ create view player_view as
 					10.0 - (time_used - time_added)
 				end
 			end
-		) as time_left
+		) as time_left,
+		atime
 	from
 		games
 		join players using(game_id)
 		join users using(user_id)
+		left join user_last_seen using(user_id)
 	;
 
 drop view if exists time_control_view;
-- 
cgit v1.2.3

