-
Notifications
You must be signed in to change notification settings - Fork 95
/
question.sql
34 lines (31 loc) · 1.26 KB
/
question.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
select * FROM sqlpage_shell;
SELECT 'form' as component,
question_text as title,
'Submit your answer' as validate,
sqlpage.link('wait.sql', json_object('game_id', $game_id, 'question_id', $question_id, 'player', $player)) as action
FROM questions
where id = $question_id::integer;
SELECT 'answer' as name,
CASE
$player
WHEN impostor THEN 'Try to trick the other players into answering: ' || wrong_answer || ', but try to make your own answer correct.'
ELSE 'Discuss the question with the other players and then submit your answer'
END as label,
'Your answer' as placeholder,
'number' as type,
TRUE as required,
TRUE as autofocus,
0 as min
FROM game_questions
WHERE game_id = $game_id::integer
AND question_id = $question_id::integer;
SELECT 'alert' as component,
'red' as color,
'Make them guess: ' || wrong_answer as title,
'You are the impostor!
Your goal is to sabotage the game by making others give an answer that will be closer to ' || wrong_answer || ' than to the true answer.
The more other players you manage to trick, the more points you will get.' as description
FROM game_questions
WHERE game_id = $game_id::integer
AND impostor = $player
AND question_id = $question_id::integer;