X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=empathy%2Fempathy.jsx;h=37fd910e75eeca154e304b08dda107414456a9dc;hp=b1f4ab201c71bff8265c88f79186c8234021369a;hb=58de8528fda4fe0afee507d5ac0c9fc1c5429736;hpb=e18a603f7a9387f29bbb69ff48d88f597a195d69
diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx
index b1f4ab2..37fd910 100644
--- a/empathy/empathy.jsx
+++ b/empathy/empathy.jsx
@@ -433,14 +433,34 @@ const PromptOptions = React.memo(props => {
const LetsPlay = React.memo(props => {
- const quorum = Math.round((props.num_players + 1) / 2);
+ const quorum = Math.max(0, props.num_players - props.prompts.length);
const max_votes = props.prompts.reduce(
(max_so_far, v) => Math.max(max_so_far, v.votes.length), 0);
- if (max_votes < quorum)
- return null;
+ if (max_votes < quorum) {
+ let text = `Before we play, we should collect a bit
+ more information about what category would
+ be interesting for this group. So, either
+ type a new category option above, or else`;
+ if (props.prompts.length) {
+ if (props.prompts.length > 1)
+ text += " vote on some of the categories below.";
+ else
+ text += " vote on the category below.";
+ } else {
+ text += " wait for others to submit, and then vote on them below.";
+ }
+
+ return (
+
+ );
+ }
- const candidates = props.prompts.filter(p => p.votes.length >= quorum);
+ const candidates = props.prompts.filter(p => p.votes.length >= max_votes);
const index = Math.floor(Math.random() * candidates.length);
const winner = candidates[index];
@@ -508,8 +528,11 @@ class Ambiguities extends React.PureComponent {
const response = await fetch_post_json(
`judged/${this.props.prompt.id}`,{
- word_groups: this.state.word_sets.map(set => Array.from(set)),
- kudos: this.state.starred ? Array.from(this.state.starred) : null
+ word_groups: this.state.word_sets.map(
+ set => ({
+ words: Array.from(set),
+ kudos: this.state.starred === set ? true : false
+ }))
}
);
@@ -1224,7 +1247,9 @@ class Game extends React.PureComponent {
}
return (
- {score.players.join("/")}: {score.score} {perfect} {quirkster}
+ {score.players.join("/")}: {score.score}
+ {score.kudos ? `, ${'â
'.repeat(score.kudos)}` : ""}
+ {perfect} {quirkster}
);
})}
@@ -1234,7 +1259,9 @@ class Game extends React.PureComponent {
{state.scores.words.map(word => {
return (
- {word.word} ({word.players.length}): {word.players.join(', ')}
+ {word.word} ({word.players.length}
+ {word.kudos.length ? `, ${'â
'.repeat(word.kudos.length)}` : ""}
+ ): {word.players.join(', ')}
);
})}
@@ -1303,15 +1330,15 @@ class Game extends React.PureComponent {
,
- ,
,
+
];
}