X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;ds=sidebyside;f=empathy%2Fempathy.jsx;h=001dcd5eeeb5ac3f943d368f971f8a78d19981d3;hb=49a7e9338a8160363ede955ae0d036abc360a359;hp=6acf526c3516da99cdf72f282c65ff5ad894a8be;hpb=c91ad4964798e3ddbc42c27a266b0c6ae1957909;p=lmno.games diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx index 6acf526..001dcd5 100644 --- a/empathy/empathy.jsx +++ b/empathy/empathy.jsx @@ -433,14 +433,14 @@ 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; - 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 +508,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 + })) } ); @@ -789,29 +792,6 @@ class ActivePrompt extends React.PureComponent { } render() { - let move_on_button = null; - if (this.props.idle) { - move_on_button =( - - ); - } let still_waiting = null; const answering_players = Object.keys(this.props.players_answering);; @@ -845,6 +825,32 @@ class ActivePrompt extends React.PureComponent { ); } + let move_on_button = null; + if (this.props.idle) { + move_on_button =( + + ); + } + if (this.props.players_answered.has(this.props.player.name)) { return (
@@ -1212,12 +1218,18 @@ class Game extends React.PureComponent {