question improvements
This commit is contained in:
parent
3977f101ad
commit
9ef6b48de0
3 changed files with 12 additions and 4 deletions
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,11 @@ export function Question() {
|
|||
setSelectedValue(question.type === "numeric" ? question.range.min : null);
|
||||
}, [question]);
|
||||
|
||||
if (!question) return null;
|
||||
if (!question) return (
|
||||
<Section>
|
||||
<SectionTitle>Preparing quiz...</SectionTitle>
|
||||
</Section>
|
||||
);
|
||||
|
||||
const partyId = party.id;
|
||||
const timeLeft = formatTimeLeft(question.endTimestamp - now);
|
||||
|
|
|
|||
Loading…
Reference in a new issue