marktask.py 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import datetime
  4. from sqlalchemy import Column, Integer, String, DateTime, Float, BOOLEAN, JSON, Enum, TEXT
  5. from db import BaseORMModel
  6. from models.const import TaskTypeEnum
  7. class MarkTask(BaseORMModel):
  8. """
  9. 阅卷任务
  10. """
  11. __tablename__ = "marktasks"
  12. id = Column(Integer, primary_key=True, autoincrement=True)
  13. name = Column(String(20), nullable=False, comment="任务名称")
  14. year = Column(Integer, nullable=False, comment="年份")
  15. pid = Column(Integer, default=0, comment="试卷ID")
  16. pno = Column(String(32), default="", comment="试卷编号")
  17. pname = Column(String(32), nullable=False, comment="试卷名称")
  18. pages = Column(Integer, default=100, comment="试卷页数")
  19. subject = Column(String(32), default="", comment="科目")
  20. pimgs = Column(String(1000), default="", comment="原始试卷图片URL列表")
  21. std_points = Column(String(1000), default="", comment="标准坐标点")
  22. ans_points = Column(String(1000), default="", comment="答题卡坐标点")
  23. stdans_config = Column(TEXT, default="", comment="答题卡配置")
  24. score = Column(Integer, default=100, comment="满分")
  25. school_id = Column(Integer, nullable=False, comment="学校ID")
  26. school_name = Column(String(32), nullable=False, comment="学校名称")
  27. grade_id = Column(Integer, nullable=False, comment="年级ID")
  28. grade_name = Column(String(32), nullable=False, comment="年级名称")
  29. class_id = Column(Integer, nullable=False, comment="班级ID")
  30. class_name = Column(String(32), nullable=False, comment="班级名称")
  31. status = Column(Integer, default=0, comment="状态,0=未开始,1=进行中,2=已完成")
  32. mtype = Column(String(4), nullable=False, comment="任务类型,work/exam")
  33. category_id = Column(Integer, nullable=True, comment="分类ID")
  34. high_score = Column(Float, default=0, comment="最高分")
  35. low_score = Column(Float, default=0, comment="最低分")
  36. avg_score = Column(Float, default=0, comment="平均分")
  37. pass_amount = Column(Integer, default=0, comment="及格人数")
  38. pass_rate = Column(Float, default=0, comment="及格率")
  39. marked_amount = Column(Integer, default=0, comment="已批阅数量")
  40. student_amount = Column(Integer, default=0, comment="参考学生人数")
  41. uploaded_amount = Column(Integer, default=0, comment="已上传数量")
  42. error_ratio = Column(Integer, default=0, comment="错题率")
  43. creator_id = Column(Integer, comment="创建人ID")
  44. creator_name = Column(String(32), comment="创建人名称")
  45. created_at = Column(DateTime, default=datetime.datetime.now)
  46. editor_id = Column(Integer, comment="最后编辑人ID")
  47. editor_name = Column(String(32), comment="最后编辑人名称")
  48. updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)
  49. # 学生阅卷任务表
  50. class StudentMarkTask(BaseORMModel):
  51. __tablename__ = "student_tasks"
  52. id = Column(Integer, primary_key=True, autoincrement=True)
  53. student_id = Column(Integer, nullable=False, comment="学生id")
  54. student_name = Column(String(32), nullable=False, comment="学生名称")
  55. student_sno = Column(String(32), nullable=False, comment="学号")
  56. task_id = Column(Integer, nullable=False, comment="阅卷任务ID")
  57. mtype = Column(String(4), nullable=False, comment="任务类型,work/exam")
  58. pid = Column(Integer, default=0, comment="试卷ID")
  59. pno = Column(String(32), default="", comment="试卷编号")
  60. pname = Column(String(255), nullable=False, comment="试卷名称")
  61. pimgs = Column(JSON, default=[], comment="原始试卷图片URL列表")
  62. question_amount = Column(Integer, default=0, comment="试题数量")
  63. marked_amount = Column(Integer, default=0, comment="已批阅试题数量")
  64. is_completed = Column(BOOLEAN(), default=False, comment="是否批阅完成")
  65. score = Column(Float, default=0, comment="得分")
  66. rank = Column(Integer, default=0, comment="名次")
  67. objective_score = Column(Float, default=0, comment="客观题得分")
  68. subjective_score = Column(Float, default=0, comment="主观题得分")
  69. status = Column(Integer, default=0, comment="状态,0=待上传,1=上传中,2已上传")
  70. creator_id = Column(Integer, comment="创建人ID")
  71. creator_name = Column(String(32), comment="创建人名称")
  72. created_at = Column(DateTime, default=datetime.datetime.now)
  73. editor_id = Column(Integer, comment="最后编辑人ID")
  74. editor_name = Column(String(32), comment="最后编辑人名称")
  75. updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)
  76. school_name = Column(String(32), default="", comment="学校名称")
  77. grade_name = Column(String(32), default="", comment="年级名称")
  78. class_name = Column(String(32), default="", comment="班级名称")
  79. # 学生作答表
  80. class StudentAnswer(BaseORMModel):
  81. __tablename__ = "student_answers"
  82. id = Column(Integer, primary_key=True, autoincrement=True)
  83. student_id = Column(Integer, nullable=False, comment="学生ID")
  84. student_name = Column(String(32), nullable=False, comment="学生名称")
  85. student_sno = Column(String(32), nullable=False, comment="学号")
  86. class_id = Column(Integer, nullable=False, comment="班级ID")
  87. task_id = Column(Integer, nullable=False, comment="阅卷任务ID")
  88. student_task_id = Column(Integer, nullable=False, comment="学生阅卷任务ID")
  89. mtype = Column(Enum(TaskTypeEnum), nullable=False, comment="任务类型,work/exam")
  90. task_name = Column(String(20), nullable=False, comment="任务名称")
  91. pid = Column(Integer, default=0, comment="试卷ID")
  92. pno = Column(String(32), default="", comment="试卷编号")
  93. pname = Column(String(255), nullable=False, comment="试卷名称")
  94. pimgs = Column(JSON, default="", comment="原始答卷")
  95. qid = Column(Integer, nullable=False, comment="试题ID")
  96. qno = Column(String(16), nullable=False, comment="题号")
  97. sqno = Column(String(16), default="", comment="子题号")
  98. stem = Column(TEXT, default="", comment="试题题干")
  99. std_answer = Column(TEXT, nullable=False, default="", comment="学生答案")
  100. qimg = Column(String(1000), nullable=False, comment="试题图片URL")
  101. answer = Column(TEXT, nullable=False, default="", comment="学生答案")
  102. score = Column(Float, default=0, comment="试题分值")
  103. qtype = Column(String(6), nullable=False, comment="单选题/多选题/判断题/主观题")
  104. status = Column(BOOLEAN(), default=False, comment="批阅状态")
  105. incorrect = Column(BOOLEAN(), default=False, comment="是否错题")
  106. marked_img = Column(String(1000), default="", comment="批阅后的试题图片URL")
  107. marked_score = Column(Float, default=0, comment="批阅得分")
  108. creator_id = Column(Integer, nullable=False, comment="创建人ID")
  109. creator_name = Column(String(32), nullable=False, comment="创建人名称")
  110. created_at = Column(DateTime, default=datetime.datetime.now)
  111. editor_id = Column(Integer, nullable=False, comment="最后编辑人ID")
  112. editor_name = Column(String(32), nullable=False, comment="最后编辑人名称")
  113. updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)
  114. school_name = Column(String(32), default="", comment="学校名称")
  115. grade_name = Column(String(32), default="", comment="年级名称")
  116. class_name = Column(String(32), default="", comment="班级名称")