#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime from sqlalchemy import Column, Integer, String, DateTime, Text, Float, BOOLEAN from db.base import Base # 阅卷任务 class MarkTask(Base): id = Column(Integer, primary_key=True, autoincrement=True) name = Column(String(20), nullable=False, comment="任务名称") year = Column(Integer, nullable=False, comment="年份") pid = Column(Integer, nullable=False, comment="试卷ID") pno = Column(String(32), nullable=False, comment="试卷编号") pname = Column(String(32), nullable=False, comment="试卷名称") pages = Column(Integer, default=100, 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=False, 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="已上传数量") 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) __tablename__ = "mark_task" # 学生阅卷任务表 class StudentMarkTask(Base): 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") pid = Column(Integer, nullable=False, comment="试卷ID") pno = Column(String(32), nullable=False, comment="试卷编号") pname = Column(String(255), nullable=False, comment="试卷名称") pimgs = Column(String(1000), nullable=True, comment="原始答卷") question_amount = Column(Integer, nullable=False, 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="主观题得分") 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) __tablename__ = "student_marktask" # 学生作答表 class StudentAnswer(Base): 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") pid = Column(Integer, nullable=False, comment="试卷ID") pno = Column(String(32), nullable=False, comment="试卷编号") pname = Column(String(255), nullable=False, comment="试卷名称") pimgs = Column(String(1000), nullable=False, comment="原始答卷") qno = Column(String(16), nullable=False, comment="题号") sqno = Column(String(16), nullable=False, comment="子题号") qimg = Column(String(1000), nullable=False, comment="试题图片URL") answer = Column(Text, nullable=False, comment="答案") score = Column(Float, default=0, comment="试题分值") qtype = Column(Integer, nullable=False, comment="试题类型,0:客观题,1: 主观题") marked_img = Column(String(1000), nullable=True, comment="批阅后的试题切片") marked_score = Column(Float, 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) __tablename__ = "student_answer"