Skip to content

Commit a27539e

Browse files
committed
Start on question match
1 parent 609bf72 commit a27539e

File tree

4 files changed

+113
-5
lines changed

4 files changed

+113
-5
lines changed

src/Server/sql/index.sql

+89-1
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,26 @@ create table complete_profiles
329329
constraint unique_completer_completed_profile unique(completer, completed)
330330
);
331331

332+
create table doppelganger_questions(
333+
id smallint primary key,
334+
question text not null
335+
);
336+
337+
create table doppelganger_choices(
338+
id integer generated always as identity primary key,
339+
choice text not null,
340+
question integer not null,
341+
constraint choice_quesiton foreign key (question) references doppelganger_questions(id) on delete cascade
342+
);
343+
344+
create table doppelganger_answers(
345+
id integer generated always as identity primary key,
346+
taker integer not null,
347+
choice integer not null,
348+
constraint choice_answer foreign key (choice) references doppelganger_choices(id) on delete cascade,
349+
constraint user_answer foreign key (taker) references users(id) on delete cascade
350+
);
351+
332352
-- when users first edit new field in their profile, place them higher in the suggestions list if have filled 3 or more profile fields
333353
create or replace function temporarily_place_at_top() returns trigger as
334354
$$
@@ -724,7 +744,8 @@ values
724744

725745
insert into experiments (code, name, description) values
726746
(0, 'Impersonation', 'Temporarily change your profile to a character, famous person or historical figure so you can chat as if it was the same person typing it'),
727-
(10, 'Word chain', 'Play Word Chain with other users');
747+
(10, 'Word chain', 'Play Word Chain with other users'),
748+
(20, 'Doppelganger', 'Answer 9 questions and find out if anyone matches you');
728749

729750
insert into stock_text (contents, text_type) values
730751
('I stayed up all night wondering where the sun went, then it dawned on me', 0),
@@ -939,3 +960,70 @@ insert into privileges (feature, name, description, quantity) values
939960
insert into badges (kind, description) values
940961
(0, 'Admin' ),
941962
(100, 'Contributor');
963+
964+
insert into doppelganger_questions (id, question) values
965+
(1, 'Which number feels more random to you?'),
966+
(2, 'If you had to invent a new drink, what would it be?'),
967+
(3, 'What is your least favorite sport?'),
968+
(4, 'What sounds more scary to you?'),
969+
(5, 'Which fictional place would you rather live in?'),
970+
(6, 'Which historical place would you rather live in?'),
971+
(7, 'If you were a magician somewhere cards are outlawed which one of these would you use instead?'),
972+
(8, 'Why didn''t you ask me which laptop I bought?'),
973+
(9, 'Which saying do you relate the most?');
974+
975+
insert into doppelganger_choices (question, choice) values
976+
(1, '37'),
977+
(1, '26'),
978+
(2, 'A soft drink'),
979+
(2, 'An alcoholic beverage'),
980+
(2, 'A new kind of tea'),
981+
(3, 'Table tennis'),
982+
(3, 'Football'),
983+
(3, 'Chess'),
984+
(3, 'Dodgeball'),
985+
(4, 'Spiders'),
986+
(4, 'Public speaking'),
987+
(4, 'A giant licking the top of my head'),
988+
(4, 'Happy birthday songs'),
989+
(4, 'Missing a connecting flight'),
990+
(5, 'Narnia'),
991+
(5, 'Middle earth'),
992+
(5, 'My last day dream'),
993+
(5, 'Vulcan'),
994+
(5, 'Candy kingdom'),
995+
(5, 'Wonderland'),
996+
(6, 'Ancient Rome'),
997+
(6, 'Ancient Mesopotamia'),
998+
(6, 'Fifth century France'),
999+
(6, 'Africa when modern humans evolved'),
1000+
(6, 'Feudal Japan'),
1001+
(6, 'Warring states China'),
1002+
(6, '2000 BC Polynesia'),
1003+
(7, 'Tarot'),
1004+
(7, 'Uno'),
1005+
(7, 'I would use cards anyway'),
1006+
(7, '52 rabbits'),
1007+
(7, 'Trump cards'),
1008+
(7, 'Pokemon cards'),
1009+
(7, 'Yu-Gi-Oh cards'),
1010+
(7, 'Nothing. Magic is ruined'),
1011+
(8, 'What is a laptop?'),
1012+
(8, 'I did'),
1013+
(8, 'It is probably a Mac'),
1014+
(8, 'I was busy solving world peace'),
1015+
(8, 'It was me who bought the laptop!'),
1016+
(8, 'Why does anyone do anything?'),
1017+
(8, 'There are more things in Heaven and Earth, Horatio, than are dreamt of in your laptop'),
1018+
(8, 'Because you are returning it'),
1019+
(8, 'I thought it was a rhetorical question'),
1020+
(9, 'Super easy, barely an inconvenience'),
1021+
(9, 'Welp, that didn''t work'),
1022+
(9, 'Yesterday you said tomorrow'),
1023+
(9, 'I have approximate knowledge of many things'),
1024+
(9, '...until I took an arrow to the knee'),
1025+
(9, 'I am walking here! I am walking here!'),
1026+
(9, 'I have no mouth and I must scream'),
1027+
(9, 'The state calls its own violence law but that of the individual crime'),
1028+
(9, 'Be the change that you wish to see in the world'),
1029+
(9, '19th February, I saw the thing I wish I had never seen');
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module Shared.Experiments.Doppelganger where
2+
3+
import Prelude
4+
5+
import Flame (Html)
6+
import Flame.Html.Attribute as HA
7+
import Flame.Html.Element as HE
8+
import Shared.Experiments.Types (ChatExperimentMessage, ChatExperimentModel)
9+
10+
view ChatExperimentModel Html ChatExperimentMessage
11+
view model = HE.div (HA.class' "word-chain duller")
12+
[ --HE.button (HA.class' "green-button") "Play!"
13+
HE.text "Currently unavailable"
14+
]

src/Shared/Experiments/Types.purs

+7-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type ChatExperimentModel =
4343
, section ImpersonationSection
4444
}
4545

46-
data Experiment = Impersonation (Maybe ImpersonationProfile) | WordChain
46+
data Experiment = Impersonation (Maybe ImpersonationProfile) | WordChain | Doppelganger
4747

4848
type ImpersonationProfile = Record IU
4949

@@ -61,25 +61,29 @@ derive instance Ord Experiment
6161

6262
instance Bounded Experiment where
6363
bottom = Impersonation Nothing
64-
top = WordChain
64+
top = Doppelganger
6565

6666
instance BoundedEnum Experiment where
6767
cardinality = Cardinality 1
6868
fromEnum = case _ of
6969
Impersonation _ → 0
7070
WordChain10
71+
Doppelganger -> 20
7172
toEnum = case _ of
7273
0Just (Impersonation Nothing)
7374
10Just WordChain
75+
20 -> Just Doppelganger
7476
_ → Nothing
7577

7678
instance Enum Experiment where
7779
succ = case _ of
7880
Impersonation _ → Just WordChain
79-
WordChainNothing
81+
WordChainJust Doppelganger
82+
Doppelganger -> Nothing
8083
pred = case _ of
8184
Impersonation _ → Nothing
8285
WordChainJust (Impersonation Nothing)
86+
Doppelganger -> Just WordChain
8387

8488
derive instance Generic Experiment _
8589

src/Shared/Experiments/View.purs

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Flame.Html.Attribute as HA
99
import Flame.Html.Element as HE
1010
import Shared.Experiments.Impersonation as SEI
1111
import Shared.Experiments.WordChain as SEW
12+
import Shared.Experiments.Doppelganger as SED
1213

1314
view ChatExperimentModel Html ChatExperimentMessage
1415
view model = HE.div (HA.class' "chat-experiments") $ case model.current of
@@ -28,4 +29,5 @@ view model = HE.div (HA.class' "chat-experiments") $ case model.current of
2829
extra ChatExperimentModel Experiment Html ChatExperimentMessage
2930
extra model = case _ of
3031
Impersonation ip → SEI.view model
31-
WordChainSEW.view model
32+
WordChainSEW.view model
33+
Doppelganger -> SED.view model

0 commit comments

Comments
 (0)