Skip to content

Commit b41f21a

Browse files
authored
Merge pull request #183 from danielemery/182-support-null-question-and-answer-text
Support empty question and answer text
2 parents 0d2c359 + 9e4cd80 commit b41f21a

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/QuizQuestions.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export interface QuizQuestionResult {
1212

1313
export interface QuizQuestionWithResults {
1414
questionNum: number;
15-
question: string;
16-
answer: string;
15+
question?: string;
16+
answer?: string;
1717
userResults: QuizQuestionResult[];
1818
myScore?: QuestionScore;
1919
averageScore?: number;
@@ -32,7 +32,10 @@ export default function QuizQuestions({ questions, reportedInaccurateOCR }: Quiz
3232

3333
return (
3434
<>
35-
<ExpandCollapseSection title='Question Details' initiallyShown={!reportedInaccurateOCR}>
35+
<ExpandCollapseSection
36+
title='Question Details'
37+
initiallyShown={!reportedInaccurateOCR && !!questions?.[0]?.question}
38+
>
3639
<div className={classNames('font-bold italic text-sm mb-4', { 'text-red-500': reportedInaccurateOCR })}>
3740
Please note these questions have been extracted using google gemini, there is no guarantee on the accuracy of
3841
the question extraction.{reportedInaccurateOCR && ' At least one user has reported the OCR to be inaccurate.'}

src/hooks/useQuizQuestions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export function useQuizQuestions(quizId: string) {
2323

2424
export interface LocalQuestion {
2525
questionNum: number;
26-
question: string;
27-
answer: string;
26+
question?: string;
27+
answer?: string;
2828
unsubmittedScore?: UnsubmittedAnswer['score'];
2929
}
3030

src/types/quiz.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export interface QuizImage {
2323
export interface QuizQuestion {
2424
id: string;
2525
questionNum: number;
26-
question: string;
27-
answer: string;
26+
question?: string;
27+
answer?: string;
2828
}
2929

3030
export type QuizAIProcessingState = 'NOT_QUEUED' | 'QUEUED' | 'COMPLETED' | 'ERRORED';

0 commit comments

Comments
 (0)