Added a new feature to check for and register inactivity during an exam
This commit is contained in:
@@ -17,6 +17,7 @@ export interface ExamState {
|
||||
partIndex: number;
|
||||
exerciseIndex: number;
|
||||
questionIndex: number;
|
||||
inactivity: number;
|
||||
}
|
||||
|
||||
export interface ExamFunctions {
|
||||
@@ -33,6 +34,7 @@ export interface ExamFunctions {
|
||||
setPartIndex: (partIndex: number) => void;
|
||||
setExerciseIndex: (exerciseIndex: number) => void;
|
||||
setQuestionIndex: (questionIndex: number) => void;
|
||||
setInactivity: (inactivity: number) => void;
|
||||
reset: () => void;
|
||||
}
|
||||
|
||||
@@ -50,6 +52,7 @@ export const initialState: ExamState = {
|
||||
partIndex: -1,
|
||||
exerciseIndex: -1,
|
||||
questionIndex: 0,
|
||||
inactivity: 0,
|
||||
};
|
||||
|
||||
const useExamStore = create<ExamState & ExamFunctions>((set) => ({
|
||||
@@ -68,6 +71,7 @@ const useExamStore = create<ExamState & ExamFunctions>((set) => ({
|
||||
setPartIndex: (partIndex: number) => set(() => ({partIndex})),
|
||||
setExerciseIndex: (exerciseIndex: number) => set(() => ({exerciseIndex})),
|
||||
setQuestionIndex: (questionIndex: number) => set(() => ({questionIndex})),
|
||||
setInactivity: (inactivity: number) => set(() => ({inactivity})),
|
||||
|
||||
reset: () => set(() => initialState),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user