feat(test): add jump to question functionality
This commit is contained in:
@ -34,6 +34,7 @@ interface SatExamState {
|
||||
startExam: () => void;
|
||||
nextQuestion: () => void;
|
||||
prevQuestion: () => void;
|
||||
goToQuestion: (index: number) => void;
|
||||
|
||||
startBreak: () => void;
|
||||
skipBreak: () => void;
|
||||
@ -82,6 +83,15 @@ export const useSatExam = create<SatExamState>()(
|
||||
}
|
||||
},
|
||||
|
||||
goToQuestion: (index: number) =>
|
||||
set((state) => {
|
||||
const total = state.currentModuleQuestions?.questions.length ?? 0;
|
||||
|
||||
if (index < 0 || index >= total) return state;
|
||||
|
||||
return { questionIndex: index };
|
||||
}),
|
||||
|
||||
startBreak: () => {
|
||||
const endTime = Date.now() + BREAK_DURATION * 1000;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user