fixup question
This commit is contained in:
parent
cd2ec07314
commit
dd4e776175
4 changed files with 28 additions and 25 deletions
|
|
@ -160,7 +160,7 @@ describe("question generation", () => {
|
||||||
questionIndex: 0,
|
questionIndex: 0,
|
||||||
question: {
|
question: {
|
||||||
...makeChoiceQuestion(
|
...makeChoiceQuestion(
|
||||||
"Which genre appears most in the party analytics?",
|
"Which genre is shared by the most party members?",
|
||||||
"audio:genre:pop",
|
"audio:genre:pop",
|
||||||
"genre:pop",
|
"genre:pop",
|
||||||
),
|
),
|
||||||
|
|
@ -175,7 +175,7 @@ describe("question generation", () => {
|
||||||
key: "audio:genre:pop",
|
key: "audio:genre:pop",
|
||||||
subjectKey: "genre:pop",
|
subjectKey: "genre:pop",
|
||||||
question: makeChoiceQuestion(
|
question: makeChoiceQuestion(
|
||||||
"Which genre appears most in the party analytics?",
|
"Which genre is shared by the most party members?",
|
||||||
"audio:genre:pop",
|
"audio:genre:pop",
|
||||||
"genre:pop",
|
"genre:pop",
|
||||||
),
|
),
|
||||||
|
|
@ -184,7 +184,7 @@ describe("question generation", () => {
|
||||||
key: "audio:artist:abba",
|
key: "audio:artist:abba",
|
||||||
subjectKey: "artist:abba",
|
subjectKey: "artist:abba",
|
||||||
question: makeChoiceQuestion(
|
question: makeChoiceQuestion(
|
||||||
"Which artist shows up most often in the shared audio data?",
|
"Which artist is ranked highest in the shared audio data?",
|
||||||
"audio:artist:abba",
|
"audio:artist:abba",
|
||||||
"artist:abba",
|
"artist:abba",
|
||||||
),
|
),
|
||||||
|
|
@ -195,7 +195,7 @@ describe("question generation", () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(question?.text).toBe(
|
expect(question?.text).toBe(
|
||||||
"Which artist shows up most often in the shared audio data?",
|
"Which artist is ranked highest in the shared audio data?",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -569,7 +569,7 @@ describe("question generation", () => {
|
||||||
|
|
||||||
expect(question?.questionKey).toBe("audio:genre:jazz");
|
expect(question?.questionKey).toBe("audio:genre:jazz");
|
||||||
expect(question?.text).toBe(
|
expect(question?.text).toBe(
|
||||||
"Which of these genres appears in the party analytics?",
|
"Which genre is ranked #3 in the party's shared genres?",
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
randomSpy.mockRestore();
|
randomSpy.mockRestore();
|
||||||
|
|
@ -583,7 +583,7 @@ describe("question generation", () => {
|
||||||
]);
|
]);
|
||||||
const question = {
|
const question = {
|
||||||
type: "choice" as const,
|
type: "choice" as const,
|
||||||
text: "Which genre appears most in the party analytics?",
|
text: "Which genre is shared by the most party members?",
|
||||||
correct: 0,
|
correct: 0,
|
||||||
startTimestamp: 1,
|
startTimestamp: 1,
|
||||||
endTimestamp: 2,
|
endTimestamp: 2,
|
||||||
|
|
@ -658,7 +658,7 @@ describe("question generation", () => {
|
||||||
]);
|
]);
|
||||||
const question = {
|
const question = {
|
||||||
type: "choice" as const,
|
type: "choice" as const,
|
||||||
text: "Which genre appears most in the party analytics?",
|
text: "Which genre is shared by the most party members?",
|
||||||
correct: 0,
|
correct: 0,
|
||||||
startTimestamp: 1,
|
startTimestamp: 1,
|
||||||
endTimestamp: 2,
|
endTimestamp: 2,
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ describe("generatePartyQuestion", () => {
|
||||||
it("attaches a fallback song to generated questions", async () => {
|
it("attaches a fallback song to generated questions", async () => {
|
||||||
mockResolvedQuestion(audioQuestionGenerator.buildAudioMetadataQuestion, {
|
mockResolvedQuestion(audioQuestionGenerator.buildAudioMetadataQuestion, {
|
||||||
type: "choice",
|
type: "choice",
|
||||||
text: "Which genre appears most in the party analytics?",
|
text: "Which genre is shared by the most party members?",
|
||||||
correct: 0,
|
correct: 0,
|
||||||
startTimestamp: 1,
|
startTimestamp: 1,
|
||||||
endTimestamp: 2,
|
endTimestamp: 2,
|
||||||
|
|
@ -119,7 +119,7 @@ describe("generatePartyQuestion", () => {
|
||||||
it("prefers metadata questions over social questions when available", async () => {
|
it("prefers metadata questions over social questions when available", async () => {
|
||||||
mockResolvedQuestion(audioQuestionGenerator.buildAudioMetadataQuestion, {
|
mockResolvedQuestion(audioQuestionGenerator.buildAudioMetadataQuestion, {
|
||||||
type: "choice",
|
type: "choice",
|
||||||
text: "Which track appears in the party analytics?",
|
text: "Which track is ranked #2 in the party analysis?",
|
||||||
correct: 0,
|
correct: 0,
|
||||||
startTimestamp: 1,
|
startTimestamp: 1,
|
||||||
endTimestamp: 2,
|
endTimestamp: 2,
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,9 @@ export async function buildAudioMetadataQuestion(
|
||||||
|
|
||||||
const genreNames = buildOrderedOptions(getMostSharedGenreNames(analytics), 4);
|
const genreNames = buildOrderedOptions(getMostSharedGenreNames(analytics), 4);
|
||||||
if (genreNames) {
|
if (genreNames) {
|
||||||
for (const genre of genreNames.slice(0, METADATA_ENTITY_POOL_SIZE)) {
|
for (const [genreIndex, genre] of genreNames
|
||||||
|
.slice(0, METADATA_ENTITY_POOL_SIZE)
|
||||||
|
.entries()) {
|
||||||
const genreOptions = buildOptionsWithCorrect(genre, genreNames, 4);
|
const genreOptions = buildOptionsWithCorrect(genre, genreNames, 4);
|
||||||
if (genreOptions) {
|
if (genreOptions) {
|
||||||
questions.push({
|
questions.push({
|
||||||
|
|
@ -109,9 +111,9 @@ export async function buildAudioMetadataQuestion(
|
||||||
question: {
|
question: {
|
||||||
type: "choice",
|
type: "choice",
|
||||||
text:
|
text:
|
||||||
genre === genreNames[0]
|
genreIndex === 0
|
||||||
? "Which genre appears most in the party analytics?"
|
? "Which genre is shared by the most party members?"
|
||||||
: "Which of these genres appears in the party analytics?",
|
: `Which genre is ranked #${genreIndex + 1} in the party's shared genres?`,
|
||||||
options: genreOptions.options,
|
options: genreOptions.options,
|
||||||
correct: genreOptions.correct,
|
correct: genreOptions.correct,
|
||||||
points: 10,
|
points: 10,
|
||||||
|
|
@ -124,10 +126,9 @@ export async function buildAudioMetadataQuestion(
|
||||||
|
|
||||||
const topArtistEntities = getFairQuestionArtists(analytics, members, history);
|
const topArtistEntities = getFairQuestionArtists(analytics, members, history);
|
||||||
const topArtists = topArtistEntities.map((artist) => artist.name);
|
const topArtists = topArtistEntities.map((artist) => artist.name);
|
||||||
for (const topArtist of topArtistEntities.slice(
|
for (const [artistIndex, topArtist] of topArtistEntities
|
||||||
0,
|
.slice(0, METADATA_ENTITY_POOL_SIZE)
|
||||||
METADATA_ENTITY_POOL_SIZE,
|
.entries()) {
|
||||||
)) {
|
|
||||||
const artistOptions = buildOptionsWithCorrect(
|
const artistOptions = buildOptionsWithCorrect(
|
||||||
topArtist.name,
|
topArtist.name,
|
||||||
topArtists,
|
topArtists,
|
||||||
|
|
@ -141,9 +142,9 @@ export async function buildAudioMetadataQuestion(
|
||||||
question: {
|
question: {
|
||||||
type: "choice",
|
type: "choice",
|
||||||
text:
|
text:
|
||||||
topArtist === topArtistEntities[0]
|
artistIndex === 0
|
||||||
? "Which artist shows up most often in the shared audio data?"
|
? "Which artist is ranked highest in the shared audio data?"
|
||||||
: "Which artist shows up in the shared audio data?",
|
: `Which artist is ranked #${artistIndex + 1} in the shared audio data?`,
|
||||||
options: artistOptions.options,
|
options: artistOptions.options,
|
||||||
correct: artistOptions.correct,
|
correct: artistOptions.correct,
|
||||||
points: 10,
|
points: 10,
|
||||||
|
|
@ -153,7 +154,9 @@ export async function buildAudioMetadataQuestion(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const topTrack of topTracks.slice(0, METADATA_ENTITY_POOL_SIZE)) {
|
for (const [trackIndex, topTrack] of topTracks
|
||||||
|
.slice(0, METADATA_ENTITY_POOL_SIZE)
|
||||||
|
.entries()) {
|
||||||
const topTrackName = topTrack?.name;
|
const topTrackName = topTrack?.name;
|
||||||
const trackOptions = topTrackName
|
const trackOptions = topTrackName
|
||||||
? buildOptionsWithCorrect(topTrackName, topTrackNames, 4)
|
? buildOptionsWithCorrect(topTrackName, topTrackNames, 4)
|
||||||
|
|
@ -166,10 +169,10 @@ export async function buildAudioMetadataQuestion(
|
||||||
question: {
|
question: {
|
||||||
type: "choice",
|
type: "choice",
|
||||||
text:
|
text:
|
||||||
topTrack === topTracks[0] &&
|
trackIndex === 0 &&
|
||||||
getTrackFairness(topTrack, members, history).memberCount > 1
|
getTrackFairness(topTrack, members, history).memberCount > 1
|
||||||
? "Which track looks most shared across the party?"
|
? "Which track is ranked highest across the party?"
|
||||||
: "Which track appears in the party analytics?",
|
: `Which track is ranked #${trackIndex + 1} in the party analysis?`,
|
||||||
options: trackOptions.options,
|
options: trackOptions.options,
|
||||||
correct: trackOptions.correct,
|
correct: trackOptions.correct,
|
||||||
points: 10,
|
points: 10,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export function DeviceChoice() {
|
||||||
enabled: Boolean(user && !party && !dismissed),
|
enabled: Boolean(user && !party && !dismissed),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!user || party || dismissed || isLoading) return null;
|
if (!user || dismissed || isLoading) return null;
|
||||||
|
|
||||||
const devices = data?.data?.devices ?? [];
|
const devices = data?.data?.devices ?? [];
|
||||||
if (devices.length > 0) return null;
|
if (devices.length > 0) return null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue