Skip to content

Commit 3318d29

Browse files
Facets as options for quizzes
1 parent c898201 commit 3318d29

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/modules/quizzes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function createQuizUrl(quizId, parameters, options, path) {
6161

6262
// Pull a (answers) from parameters and transform
6363
if (answers && answers.length) {
64-
answersParamString = `&${helpers.stringify({ a: answers.map((ans) => [...ans].join(',')) })}`;
64+
answersParamString = `&${helpers.stringify({ a: answers.map((ans) => [...ans.map(encodeURIComponent)].join(',')) })}`;
6565
}
6666

6767
// Pull page from parameters

src/types/quizzes.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export interface QuizResultData extends Record<string, any> {
115115
variations: Record<string, any>[];
116116
}
117117

118-
export type Question = SelectQuestion | OpenQuestion | CoverQuestion;
118+
export type Question = SelectQuestion | FilterValueQuestion | OpenQuestion | CoverQuestion;
119119

120120
export interface BaseQuestion extends Record<string, any> {
121121
id: number;
@@ -125,6 +125,12 @@ export interface BaseQuestion extends Record<string, any> {
125125
images?: Nullable<QuestionImages>;
126126
}
127127

128+
export interface FilterValueQuestion extends BaseQuestion {
129+
type: 'single_filter_value' |'multiple_filter_values';
130+
filter_name: string;
131+
options: QuestionOption[];
132+
}
133+
128134
export interface SelectQuestion extends BaseQuestion {
129135
type: 'single' | 'multiple';
130136
options: QuestionOption[];

src/types/tests/quizzes.test-d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ expectAssignable<QuizResultsConfigResponse>({
293293
is_active: true,
294294
text: 'Sample response summary',
295295
items_separator: ',',
296-
last_separator: 'and'
296+
last_separator: 'and',
297297
},
298298
},
299299
},

0 commit comments

Comments
 (0)