123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import datetime
- from sqlalchemy import Column, Integer, String, DateTime, Float, BOOLEAN, JSON, Enum, TEXT
- from db import BaseORMModel
- from models.const import TaskTypeEnum
- class MarkTask(BaseORMModel):
- """
- 阅卷任务
- """
- __tablename__ = "marktasks"
- id = Column(Integer, primary_key=True, autoincrement=True)
- name = Column(String(20), nullable=False, comment="任务名称")
- year = Column(Integer, nullable=False, comment="年份")
- pid = Column(Integer, default=0, comment="试卷ID")
- pno = Column(String(32), default="", comment="试卷编号")
- pname = Column(String(32), nullable=False, comment="试卷名称")
- pages = Column(Integer, default=100, comment="试卷页数")
- subject = Column(String(32), default="", comment="科目")
- pimgs = Column(String(1000), default="", comment="原始试卷图片URL列表")
- std_points = Column(String(1000), default="", comment="标准坐标点")
- ans_points = Column(String(1000), default="", comment="答题卡坐标点")
- stdans_config = Column(TEXT, default="", comment="答题卡配置")
- score = Column(Integer, default=100, comment="满分")
- school_id = Column(Integer, nullable=False, comment="学校ID")
- school_name = Column(String(32), nullable=False, comment="学校名称")
- grade_id = Column(Integer, nullable=False, comment="年级ID")
- grade_name = Column(String(32), nullable=False, comment="年级名称")
- class_id = Column(Integer, nullable=False, comment="班级ID")
- class_name = Column(String(32), nullable=False, comment="班级名称")
- status = Column(Integer, default=0, comment="状态,0=未开始,1=进行中,2=已完成")
- mtype = Column(String(4), nullable=False, comment="任务类型,work/exam")
- category_id = Column(Integer, nullable=True, comment="分类ID")
- high_score = Column(Float, default=0, comment="最高分")
- low_score = Column(Float, default=0, comment="最低分")
- avg_score = Column(Float, default=0, comment="平均分")
- pass_amount = Column(Integer, default=0, comment="及格人数")
- pass_rate = Column(Float, default=0, comment="及格率")
- marked_amount = Column(Integer, default=0, comment="已批阅数量")
- student_amount = Column(Integer, default=0, comment="参考学生人数")
- uploaded_amount = Column(Integer, default=0, comment="已上传数量")
- error_ratio = Column(Integer, default=0, comment="错题率")
- creator_id = Column(Integer, comment="创建人ID")
- creator_name = Column(String(32), comment="创建人名称")
- created_at = Column(DateTime, default=datetime.datetime.now)
- editor_id = Column(Integer, comment="最后编辑人ID")
- editor_name = Column(String(32), comment="最后编辑人名称")
- updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)
- # 学生阅卷任务表
- class StudentMarkTask(BaseORMModel):
- __tablename__ = "student_tasks"
- id = Column(Integer, primary_key=True, autoincrement=True)
- student_id = Column(Integer, nullable=False, comment="学生id")
- student_name = Column(String(32), nullable=False, comment="学生名称")
- student_sno = Column(String(32), nullable=False, comment="学号")
- task_id = Column(Integer, nullable=False, comment="阅卷任务ID")
- mtype = Column(String(4), nullable=False, comment="任务类型,work/exam")
- pid = Column(Integer, default=0, comment="试卷ID")
- pno = Column(String(32), default="", comment="试卷编号")
- pname = Column(String(255), nullable=False, comment="试卷名称")
- pimgs = Column(JSON, default=[], comment="原始试卷图片URL列表")
- question_amount = Column(Integer, default=0, comment="试题数量")
- marked_amount = Column(Integer, default=0, comment="已批阅试题数量")
- is_completed = Column(BOOLEAN(), default=False, comment="是否批阅完成")
- score = Column(Float, default=0, comment="得分")
- rank = Column(Integer, default=0, comment="名次")
- objective_score = Column(Float, default=0, comment="客观题得分")
- subjective_score = Column(Float, default=0, comment="主观题得分")
- status = Column(Integer, default=0, comment="状态,0=待上传,1=上传中,2已上传")
- creator_id = Column(Integer, comment="创建人ID")
- creator_name = Column(String(32), comment="创建人名称")
- created_at = Column(DateTime, default=datetime.datetime.now)
- editor_id = Column(Integer, comment="最后编辑人ID")
- editor_name = Column(String(32), comment="最后编辑人名称")
- updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)
- school_name = Column(String(32), default="", comment="学校名称")
- grade_name = Column(String(32), default="", comment="年级名称")
- class_name = Column(String(32), default="", comment="班级名称")
- # 学生作答表
- class StudentAnswer(BaseORMModel):
- __tablename__ = "student_answers"
- id = Column(Integer, primary_key=True, autoincrement=True)
- student_id = Column(Integer, nullable=False, comment="学生ID")
- student_name = Column(String(32), nullable=False, comment="学生名称")
- student_sno = Column(String(32), nullable=False, comment="学号")
- class_id = Column(Integer, nullable=False, comment="班级ID")
- task_id = Column(Integer, nullable=False, comment="阅卷任务ID")
- student_task_id = Column(Integer, nullable=False, comment="学生阅卷任务ID")
- mtype = Column(Enum(TaskTypeEnum), nullable=False, comment="任务类型,work/exam")
- task_name = Column(String(20), nullable=False, comment="任务名称")
- pid = Column(Integer, default=0, comment="试卷ID")
- pno = Column(String(32), default="", comment="试卷编号")
- pname = Column(String(255), nullable=False, comment="试卷名称")
- pimgs = Column(JSON, default="", comment="原始答卷")
- qid = Column(Integer, nullable=False, comment="试题ID")
- qno = Column(String(16), nullable=False, comment="题号")
- sqno = Column(String(16), default="", comment="子题号")
- stem = Column(TEXT, default="", comment="试题题干")
- std_answer = Column(TEXT, nullable=False, default="", comment="学生答案")
- qimg = Column(String(1000), nullable=False, comment="试题图片URL")
- answer = Column(TEXT, nullable=False, default="", comment="学生答案")
- score = Column(Float, default=0, comment="试题分值")
- qtype = Column(String(6), nullable=False, comment="单选题/多选题/判断题/主观题")
- status = Column(BOOLEAN(), default=False, comment="批阅状态")
- incorrect = Column(BOOLEAN(), default=False, comment="是否错题")
- marked_img = Column(String(1000), default="", comment="批阅后的试题图片URL")
- marked_score = Column(Float, default=0, 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)
- school_name = Column(String(32), default="", comment="学校名称")
- grade_name = Column(String(32), default="", comment="年级名称")
- class_name = Column(String(32), default="", comment="班级名称")
|