mark.py 5.9 KB

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