problem.py 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import datetime
  4. from sqlalchemy import Column, Integer, String, DateTime, Float, JSON
  5. from db import BaseORMModel
  6. # 班级错题推送记录表
  7. class ClassErrorPushRecord(BaseORMModel):
  8. __tablename__ = "class_push_records"
  9. id = Column(Integer, primary_key=True, autoincrement=True)
  10. school_id = Column(Integer, nullable=False, comment="学校ID")
  11. school_name = Column(String(256), default="", comment="学校名称")
  12. grade_id = Column(Integer, nullable=False, comment="年级ID")
  13. grade_name = Column(String(256), default="", comment="年级名称")
  14. class_id = Column(Integer, nullable=False, comment="班级ID")
  15. class_name = Column(String(32), default="", comment="班级名称")
  16. task_id = Column(Integer, nullable=False, comment="试卷ID")
  17. task_name = Column(String(32), nullable=False, comment="试卷名称")
  18. task_type = Column(String(4), nullable=False, comment="任务类型,work/exam")
  19. error_count = Column(Integer, default=0, comment="错题数量")
  20. student_count = Column(Integer, default=0, comment="学生数量")
  21. push_student_count = Column(Integer, default=0, comment="已推送学生数量")
  22. push_student_ids = Column(JSON, default=[], comment="已推送学生ID列表")
  23. printed = Column(Integer, default=0, comment="是否打印,0-未打印, N-打印中,100-已打印")
  24. remark = Column(String(256), default="", comment="备注")
  25. creator_id = Column(Integer, nullable=False, comment="创建人ID")
  26. creator_name = Column(String(32), nullable=False, comment="创建人名称")
  27. created_at = Column(DateTime, default=datetime.datetime.now)
  28. editor_id = Column(Integer, nullable=False, comment="最后编辑人ID")
  29. editor_name = Column(String(32), nullable=False, comment="最后编辑人名称")
  30. updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)
  31. # 学生错题推送记录表
  32. class StudentErrorPushRecord(BaseORMModel):
  33. __tablename__ = "student_push_records"
  34. id = Column(Integer, primary_key=True, autoincrement=True)
  35. student_id = Column(Integer, nullable=False, comment="学生ID")
  36. student_sno = Column(String(20), nullable=False, comment="学号")
  37. student_name = Column(String(20), nullable=False, comment="姓名")
  38. task_id = Column(Integer, nullable=False, comment="试卷ID")
  39. task_name = Column(String(32), nullable=False, comment="试卷名称")
  40. task_type = Column(String(4), nullable=False, comment="任务类型,work/exam")
  41. question_count = Column(Integer, default=0, comment="任务总题数")
  42. push_record_id = Column(Integer, nullable=False, comment="班级推送记录ID")
  43. push_error_count = Column(Integer, default=0, comment="已推送错题数量")
  44. push_error_ids = Column(JSON, default=[], comment="已推送错题ID列表")
  45. printed = Column(Integer, default=0, comment="是否打印,0-未打印, N-打印中,100-已打印")
  46. creator_id = Column(Integer, nullable=False, comment="创建人ID")
  47. creator_name = Column(String(32), nullable=False, comment="创建人名称")
  48. created_at = Column(DateTime, default=datetime.datetime.now)
  49. editor_id = Column(Integer, nullable=False, comment="最后编辑人ID")
  50. editor_name = Column(String(32), nullable=False, comment="最后编辑人名称")
  51. updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)
  52. # 班级错题表
  53. class ClassErrorQuestion(BaseORMModel):
  54. __tablename__ = "class_error_questions"
  55. id = Column(Integer, primary_key=True, autoincrement=True)
  56. school_id = Column(Integer, nullable=False, comment="学校ID")
  57. school_name = Column(String(256), default="", comment="学校名称")
  58. grade_id = Column(Integer, nullable=False, comment="年级ID")
  59. grade_name = Column(String(256), default="", comment="年级名称")
  60. class_id = Column(Integer, nullable=False, comment="班级ID")
  61. class_name = Column(String(256), default="", comment="班级名称")
  62. student_count = Column(Integer, default=0, comment="班级人数")
  63. error_count = Column(Integer, default=0, comment="错误人数")
  64. error_ratio = Column(Float, default=0, comment="错误率")
  65. task_id = Column(Integer, nullable=False, comment="阅卷任务ID")
  66. task_type = Column(String(4), nullable=False, comment="阅卷任务类型,work/exam")
  67. task_name = Column(String(20), nullable=False, comment="任务名称")
  68. qid = Column(Integer, nullable=False, comment="试题ID")
  69. answer_dist = Column(String(100), default="", comment="答案分布图,非单选题用")
  70. # 学生错题表
  71. class StudentErrorQuestion(BaseORMModel):
  72. __tablename__ = "student_error_questions"
  73. id = Column(Integer, primary_key=True, autoincrement=True)
  74. school_id = Column(Integer, nullable=False, comment="学校ID")
  75. school_name = Column(String(256), default="", comment="学校名称")
  76. grade_id = Column(Integer, nullable=False, comment="年级ID")
  77. grade_name = Column(String(256), default="", comment="年级名称")
  78. class_id = Column(Integer, nullable=False, comment="班级ID")
  79. class_name = Column(String(256), default="", comment="班级名称")
  80. student_id = Column(Integer, nullable=False, comment="学生ID")
  81. student_sno = Column(String(20), nullable=False, comment="学号")
  82. student_name = Column(String(20), nullable=False, comment="学生姓名")
  83. total_questions = Column(Integer, default=0, comment="试题总数")
  84. total_errors = Column(Integer, default=0, comment="错题总数")
  85. exam_error_count = Column(Integer, default=0, comment="考试错题数")
  86. work_error_count = Column(Integer, default=0, comment="作业错题数")
  87. error_ratio = Column(Float, default=0, comment="错误率")
  88. task_id = Column(Integer, default=0, comment="阅卷任务ID")
  89. student_task_id = Column(Integer, default=0, comment="学生阅卷任务ID")