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