Exam generation rework, batch user tables, fastapi endpoint switch
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {Module} from ".";
|
||||
import { Module } from ".";
|
||||
|
||||
export type Exam = ReadingExam | ListeningExam | WritingExam | SpeakingExam | LevelExam;
|
||||
export type Variant = "full" | "partial";
|
||||
@@ -25,7 +25,13 @@ export interface ReadingExam extends ExamBase {
|
||||
type: "academic" | "general";
|
||||
}
|
||||
|
||||
export interface ReadingPart {
|
||||
export interface Section {
|
||||
intro?: string;
|
||||
category?: string;
|
||||
sectionId?: number;
|
||||
}
|
||||
|
||||
export interface ReadingPart extends Section {
|
||||
text: {
|
||||
title: string;
|
||||
content: string;
|
||||
@@ -38,10 +44,8 @@ export interface LevelExam extends ExamBase {
|
||||
parts: LevelPart[];
|
||||
}
|
||||
|
||||
export interface LevelPart {
|
||||
export interface LevelPart extends Section {
|
||||
context?: string;
|
||||
intro?: string;
|
||||
category?: string;
|
||||
exercises: Exercise[];
|
||||
}
|
||||
|
||||
@@ -50,11 +54,15 @@ export interface ListeningExam extends ExamBase {
|
||||
module: "listening";
|
||||
}
|
||||
|
||||
export interface ListeningPart {
|
||||
audio: {
|
||||
export type Dialog = { "name": string; "gender": string; "text": string; };
|
||||
export type Script = Dialog[] | string;
|
||||
|
||||
export interface ListeningPart extends Section {
|
||||
audio?: {
|
||||
source: string;
|
||||
repeatableTimes: number; // *The amount of times the user is allowed to repeat the audio, 0 for unlimited
|
||||
};
|
||||
script?: Script;
|
||||
exercises: Exercise[];
|
||||
}
|
||||
|
||||
@@ -76,6 +84,7 @@ export interface UserSolution {
|
||||
|
||||
export interface WritingExam extends ExamBase {
|
||||
module: "writing";
|
||||
enableNavigation?: boolean;
|
||||
exercises: WritingExercise[];
|
||||
}
|
||||
|
||||
@@ -103,19 +112,19 @@ export type Exercise =
|
||||
export interface Evaluation {
|
||||
comment: string;
|
||||
overall: number;
|
||||
task_response: {[key: string]: number | {grade: number; comment: string}};
|
||||
misspelled_pairs?: {correction: string | null; misspelled: string}[];
|
||||
task_response: { [key: string]: number | { grade: number; comment: string } };
|
||||
misspelled_pairs?: { correction: string | null; misspelled: string }[];
|
||||
}
|
||||
|
||||
type InteractivePerfectAnswerKey = `perfect_answer_${number}`;
|
||||
type InteractiveTranscriptKey = `transcript_${number}`;
|
||||
type InteractiveFixedTextKey = `fixed_text_${number}`;
|
||||
|
||||
type InteractivePerfectAnswerType = {[key in InteractivePerfectAnswerKey]: {answer: string}};
|
||||
type InteractiveTranscriptType = {[key in InteractiveTranscriptKey]?: string};
|
||||
type InteractiveFixedTextType = {[key in InteractiveFixedTextKey]?: string};
|
||||
type InteractivePerfectAnswerType = { [key in InteractivePerfectAnswerKey]: { answer: string } };
|
||||
type InteractiveTranscriptType = { [key in InteractiveTranscriptKey]?: string };
|
||||
type InteractiveFixedTextType = { [key in InteractiveFixedTextKey]?: string };
|
||||
|
||||
interface InteractiveSpeakingEvaluation extends Evaluation, InteractivePerfectAnswerType, InteractiveTranscriptType, InteractiveFixedTextType {}
|
||||
interface InteractiveSpeakingEvaluation extends Evaluation, InteractivePerfectAnswerType, InteractiveTranscriptType, InteractiveFixedTextType { }
|
||||
|
||||
interface SpeakingEvaluation extends CommonEvaluation {
|
||||
perfect_answer_1?: string;
|
||||
@@ -128,7 +137,7 @@ interface CommonEvaluation extends Evaluation {
|
||||
fixed_text?: string;
|
||||
}
|
||||
|
||||
export interface WritingExercise {
|
||||
export interface WritingExercise extends Section {
|
||||
id: string;
|
||||
type: "writing";
|
||||
prefix: string; //* The information about the task, like the amount of time they should spend on it
|
||||
@@ -165,7 +174,7 @@ export interface WritingEvaluation extends CommonEvaluation {
|
||||
ai_detection?: AIDetectionAttributes;
|
||||
}
|
||||
|
||||
export interface SpeakingExercise {
|
||||
export interface SpeakingExercise extends Section {
|
||||
id: string;
|
||||
type: "speaking";
|
||||
title: string;
|
||||
@@ -179,25 +188,27 @@ export interface SpeakingExercise {
|
||||
evaluation?: SpeakingEvaluation;
|
||||
}[];
|
||||
topic?: string;
|
||||
script?: Script;
|
||||
}
|
||||
|
||||
export interface InteractiveSpeakingExercise {
|
||||
export interface InteractiveSpeakingExercise extends Section {
|
||||
id: string;
|
||||
type: "interactiveSpeaking";
|
||||
title: string;
|
||||
first_title?: string;
|
||||
second_title?: string;
|
||||
text: string;
|
||||
prompts: {text: string; video_url: string}[];
|
||||
prompts: { text: string; video_url: string }[];
|
||||
userSolutions: {
|
||||
id: string;
|
||||
solution: {questionIndex: number; question: string; answer: string}[];
|
||||
solution: { questionIndex: number; question: string; answer: string }[];
|
||||
evaluation?: InteractiveSpeakingEvaluation;
|
||||
}[];
|
||||
topic?: string;
|
||||
first_topic?: string;
|
||||
second_topic?: string;
|
||||
variant?: "initial" | "final";
|
||||
script?: Script;
|
||||
}
|
||||
|
||||
export interface FillBlanksMCOption {
|
||||
@@ -214,7 +225,7 @@ export interface FillBlanksExercise {
|
||||
prompt: string; // *EXAMPLE: "Complete the summary below. Click a blank to select the corresponding word for it."
|
||||
type: "fillBlanks";
|
||||
id: string;
|
||||
words: (string | {letter: string; word: string} | FillBlanksMCOption)[]; // *EXAMPLE: ["preserve", "unaware"]
|
||||
words: (string | { letter: string; word: string } | FillBlanksMCOption)[]; // *EXAMPLE: ["preserve", "unaware"]
|
||||
text: string; // *EXAMPLE: "They tried to {{1}} burning"
|
||||
allowRepetition?: boolean;
|
||||
solutions: {
|
||||
@@ -233,13 +244,13 @@ export interface TrueFalseExercise {
|
||||
id: string;
|
||||
prompt: string; // *EXAMPLE: "Select the appropriate option."
|
||||
questions: TrueFalseQuestion[];
|
||||
userSolutions: {id: string; solution: "true" | "false" | "not_given"}[];
|
||||
userSolutions: { id: string; solution: "true" | "false" | "not_given" }[];
|
||||
}
|
||||
|
||||
export interface TrueFalseQuestion {
|
||||
id: string; // *EXAMPLE: "1"
|
||||
prompt: string; // *EXAMPLE: "What does her briefcase look like?"
|
||||
solution: "true" | "false" | "not_given"; // *EXAMPLE: "True"
|
||||
solution: "true" | "false" | "not_given" | undefined; // *EXAMPLE: "True"
|
||||
}
|
||||
|
||||
export interface WriteBlanksExercise {
|
||||
@@ -256,23 +267,24 @@ export interface WriteBlanksExercise {
|
||||
id: string;
|
||||
solution: string;
|
||||
}[];
|
||||
variant?: string;
|
||||
}
|
||||
|
||||
export interface MatchSentencesExercise {
|
||||
type: "matchSentences";
|
||||
id: string;
|
||||
prompt: string;
|
||||
userSolutions: {question: string; option: string}[];
|
||||
userSolutions: { question: string; option: string }[];
|
||||
sentences: MatchSentenceExerciseSentence[];
|
||||
allowRepetition: boolean;
|
||||
options: MatchSentenceExerciseOption[];
|
||||
variant?: string;
|
||||
}
|
||||
|
||||
export interface MatchSentenceExerciseSentence {
|
||||
id: string;
|
||||
sentence: string;
|
||||
solution: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
export interface MatchSentenceExerciseOption {
|
||||
@@ -285,7 +297,8 @@ export interface MultipleChoiceExercise {
|
||||
id: string;
|
||||
prompt: string; // *EXAMPLE: "Select the appropriate option."
|
||||
questions: MultipleChoiceQuestion[];
|
||||
userSolutions: {question: string; option: string}[];
|
||||
userSolutions: { question: string; option: string }[];
|
||||
mcVariant?: string;
|
||||
}
|
||||
|
||||
export interface MultipleChoiceQuestion {
|
||||
@@ -312,3 +325,5 @@ export interface Shuffles {
|
||||
exerciseID: string;
|
||||
shuffles: ShuffleMap[];
|
||||
}
|
||||
|
||||
export type ModuleExam = LevelExam | ReadingExam | ListeningExam | WritingExam | SpeakingExam;
|
||||
|
||||
8
src/interfaces/option.ts
Normal file
8
src/interfaces/option.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { IconType } from "react-icons";
|
||||
|
||||
export default interface Option {
|
||||
[key: string]: any;
|
||||
value: string | null;
|
||||
label: string;
|
||||
icon?: IconType
|
||||
}
|
||||
Reference in New Issue
Block a user