diff --git a/api/src/party/numeric-question-generator.ts b/api/src/party/numeric-question-generator.ts index 87c4dda..a91d3ff 100644 --- a/api/src/party/numeric-question-generator.ts +++ b/api/src/party/numeric-question-generator.ts @@ -38,7 +38,7 @@ async function getAlbumReleaseYear({ type: "numeric", text: `What's the release year of ${subject}?`, correct, - range: getQuestionRange(correct, 5), + range: getQuestionRange(correct, 10, 3), points: 10, }; } diff --git a/api/src/party/question-utils.ts b/api/src/party/question-utils.ts index ae8f557..47591a7 100644 --- a/api/src/party/question-utils.ts +++ b/api/src/party/question-utils.ts @@ -77,10 +77,14 @@ export function getQuestionDistanceScore( export function getQuestionRange( correctValue: number, tolerance: number, + randomness: number, ): { min: number; max: number } { + const min = Math.floor(correctValue - tolerance); + const max = Math.ceil(correctValue + tolerance); + const range = max - min; return { - min: Math.floor(correctValue - tolerance), - max: Math.ceil(correctValue + tolerance), + min: min + Math.floor(Math.random() * range * randomness), + max: max - Math.floor(Math.random() * range * randomness), }; } diff --git a/web/src/components/party/question.tsx b/web/src/components/party/question.tsx index 74e10cf..9de88d9 100644 --- a/web/src/components/party/question.tsx +++ b/web/src/components/party/question.tsx @@ -54,7 +54,11 @@ export function Question() { setSelectedValue(question.type === "numeric" ? question.range.min : null); }, [question]); - if (!question) return null; + if (!question) return ( +
+ Preparing quiz... +
+ ); const partyId = party.id; const timeLeft = formatTimeLeft(question.endTimestamp - now);