#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime from sqlalchemy import Column, Integer, String, DateTime, Float, JSON from db import BaseORMModel # 班级错题推送记录表 class ClassErrorPushRecord(BaseORMModel): __tablename__ = "class_push_records" id = Column(Integer, primary_key=True, autoincrement=True) school_id = Column(Integer, nullable=False, comment="学校ID") school_name = Column(String(256), default="", comment="学校名称") grade_id = Column(Integer, nullable=False, comment="年级ID") grade_name = Column(String(256), default="", comment="年级名称") class_id = Column(Integer, nullable=False, comment="班级ID") class_name = Column(String(32), default="", comment="班级名称") task_id = Column(Integer, nullable=False, comment="试卷ID") task_name = Column(String(32), nullable=False, comment="试卷名称") task_type = Column(String(4), nullable=False, comment="任务类型,work/exam") error_count = Column(Integer, default=0, comment="错题数量") student_count = Column(Integer, default=0, comment="学生数量") push_student_count = Column(Integer, default=0, comment="已推送学生数量") push_student_ids = Column(JSON, default=[], comment="已推送学生ID列表") printed = Column(Integer, default=0, comment="是否打印,0-未打印, N-打印中,100-已打印") remark = Column(String(256), default="", comment="备注") creator_id = Column(Integer, nullable=False, comment="创建人ID") creator_name = Column(String(32), nullable=False, comment="创建人名称") created_at = Column(DateTime, default=datetime.datetime.now) editor_id = Column(Integer, nullable=False, comment="最后编辑人ID") editor_name = Column(String(32), nullable=False, comment="最后编辑人名称") updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now) # 学生错题推送记录表 class StudentErrorPushRecord(BaseORMModel): __tablename__ = "student_push_records" id = Column(Integer, primary_key=True, autoincrement=True) student_id = Column(Integer, nullable=False, comment="学生ID") student_sno = Column(String(20), nullable=False, comment="学号") student_name = Column(String(20), nullable=False, comment="姓名") task_id = Column(Integer, nullable=False, comment="试卷ID") task_name = Column(String(32), nullable=False, comment="试卷名称") task_type = Column(String(4), nullable=False, comment="任务类型,work/exam") question_count = Column(Integer, default=0, comment="任务总题数") push_record_id = Column(Integer, nullable=False, comment="班级推送记录ID") push_error_count = Column(Integer, default=0, comment="已推送错题数量") push_error_ids = Column(JSON, default=[], comment="已推送错题ID列表") printed = Column(Integer, default=0, comment="是否打印,0-未打印, N-打印中,100-已打印") creator_id = Column(Integer, nullable=False, comment="创建人ID") creator_name = Column(String(32), nullable=False, comment="创建人名称") created_at = Column(DateTime, default=datetime.datetime.now) editor_id = Column(Integer, nullable=False, comment="最后编辑人ID") editor_name = Column(String(32), nullable=False, comment="最后编辑人名称") updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now) # 班级错题表 class ClassErrorQuestion(BaseORMModel): __tablename__ = "class_error_questions" id = Column(Integer, primary_key=True, autoincrement=True) school_id = Column(Integer, nullable=False, comment="学校ID") school_name = Column(String(256), default="", comment="学校名称") grade_id = Column(Integer, nullable=False, comment="年级ID") grade_name = Column(String(256), default="", comment="年级名称") class_id = Column(Integer, nullable=False, comment="班级ID") class_name = Column(String(256), default="", comment="班级名称") student_count = Column(Integer, default=0, comment="班级人数") error_count = Column(Integer, default=0, comment="错误人数") error_ratio = Column(Float, default=0, comment="错误率") task_id = Column(Integer, nullable=False, comment="阅卷任务ID") task_type = Column(String(4), nullable=False, comment="阅卷任务类型,work/exam") task_name = Column(String(20), nullable=False, comment="任务名称") qid = Column(Integer, nullable=False, comment="试题ID") answer_dist = Column(String(100), default="", comment="答案分布图,非单选题用") # 学生错题表 class StudentErrorQuestion(BaseORMModel): __tablename__ = "student_error_questions" id = Column(Integer, primary_key=True, autoincrement=True) school_id = Column(Integer, nullable=False, comment="学校ID") school_name = Column(String(256), default="", comment="学校名称") grade_id = Column(Integer, nullable=False, comment="年级ID") grade_name = Column(String(256), default="", comment="年级名称") class_id = Column(Integer, nullable=False, comment="班级ID") class_name = Column(String(256), default="", comment="班级名称") student_id = Column(Integer, nullable=False, comment="学生ID") student_sno = Column(String(20), nullable=False, comment="学号") student_name = Column(String(20), nullable=False, comment="学生姓名") total_questions = Column(Integer, default=0, comment="试题总数") total_errors = Column(Integer, default=0, comment="错题总数") exam_error_count = Column(Integer, default=0, comment="考试错题数") work_error_count = Column(Integer, default=0, comment="作业错题数") error_ratio = Column(Float, default=0, comment="错误率") task_id = Column(Integer, default=0, comment="阅卷任务ID") student_task_id = Column(Integer, default=0, comment="学生阅卷任务ID")