#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import List, Optional, Dict, Any from pydantic import BaseModel, Field from schemas.base import Datetime2Str, ListMixin, DetailMixin class MarkTaskItem(BaseModel): id: int pid: int name: str score: int high_score: float avg_score: float pass_rate: float marked_amount: int student_amount: int uploaded_amount: int updated_at: Datetime2Str class Config: orm_mode = True class MarkTaskList(ListMixin): data: List[MarkTaskItem] = [] class MarkTask4Detail(BaseModel): id: int name: str pid: str pno: str score: int high_score: float avg_score: float pass_rate: float school_name: str grade_name: str class_name: str marked_amount: int student_amount: int uploaded_amount: int class Config: orm_mode = True class MarkTaskDetail(DetailMixin): data: Optional[MarkTask4Detail] = None score_table: List[Dict[str, Any]] = [] score_chart: List[Dict[str, Any]] = [] class MarkTaskAnswerItem(BaseModel): qno: str sqno: str = "" answer: str analysis: str img: str dist: List[Dict[str, Any]] = [] class MarkTaskAnswerList(ListMixin): data: List[MarkTaskAnswerItem] = None class QuestionItem(BaseModel): id: int student_id: int student_name: str student_sno: str qimg: str score: int marked_score: float class Config: orm_mode = True class MarkTaskQuestionList(ListMixin): data: List[QuestionItem] = [] class MarkQuestionDetail(DetailMixin): pass class UpdateMarkTaskQuestion(BaseModel): marked_score: float = Field(..., alias="score", description="得分") marked_img: str = Field(..., alias="img", description="批阅后的试题图片URL") class Config: anystr_strip_whitespace = True class BgUpdateTaskReviewInfo(BaseModel): high_score: float avg_score: float pass_amount: int pass_rate: float marked_amount: int status: Optional[int] = None class Config: anystr_strip_whitespace = True class BgUpdateStudentTaskInfo(BaseModel): marked_amount: int is_completed: bool score: float objective_score: float = 0 subjective_score: float = 0 editor_id: int editor_name: str class Config: anystr_strip_whitespace = True class StudentMarkTaskItem(BaseModel): id: int student_id: int student_sno: str student_name: str score: float objective_score: float subjective_score: float rank: int = 0 wrong_questions: List[str] = [] class Config: orm_mode = True class StudentMarkTaskList(ListMixin): data: List[StudentMarkTaskItem] = [] class StudentMarkTaskDetail(DetailMixin): data: StudentMarkTaskItem class StudentAnswerItem(BaseModel): qno: str sqno: str = "" answer: str analysis: str marked_img: str dist: List[Dict[str, Any]] = [] class StudentAnswerList(ListMixin): data: List[StudentAnswerItem] class MarkProcessItem(BaseModel): qno: str = None question_amount: int = None marked_amount: int = None class MarkProcessList(ListMixin): data: List[MarkProcessItem] = []