task.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from typing import List, Optional, Dict, Any
  4. from pydantic import BaseModel, Field
  5. from schemas.base import Datetime2Str, ListMixin, DetailMixin
  6. class MarkTaskItem(BaseModel):
  7. id: int
  8. pid: int
  9. name: str
  10. score: int
  11. high_score: float
  12. avg_score: float
  13. pass_rate: float
  14. marked_amount: int
  15. student_amount: int
  16. uploaded_amount: int
  17. updated_at: Datetime2Str
  18. class Config:
  19. orm_mode = True
  20. class MarkTaskList(ListMixin):
  21. data: List[MarkTaskItem] = []
  22. class MarkTask4Detail(BaseModel):
  23. id: int
  24. name: str
  25. pid: str
  26. pno: str
  27. score: int
  28. high_score: float
  29. avg_score: float
  30. pass_rate: float
  31. school_name: str
  32. grade_name: str
  33. class_name: str
  34. marked_amount: int
  35. student_amount: int
  36. uploaded_amount: int
  37. class Config:
  38. orm_mode = True
  39. class MarkTaskDetail(DetailMixin):
  40. data: Optional[MarkTask4Detail] = None
  41. score_table: List[Dict[str, Any]] = []
  42. score_chart: List[Dict[str, Any]] = []
  43. class MarkTaskAnswerItem(BaseModel):
  44. qno: str
  45. sqno: str = ""
  46. answer: str
  47. analysis: str
  48. img: str
  49. dist: List[Dict[str, Any]] = []
  50. class MarkTaskAnswerList(ListMixin):
  51. data: List[MarkTaskAnswerItem] = None
  52. class QuestionItem(BaseModel):
  53. id: int
  54. student_id: int
  55. student_name: str
  56. student_sno: str
  57. qimg: str
  58. score: int
  59. marked_score: float
  60. class Config:
  61. orm_mode = True
  62. class MarkTaskQuestionList(ListMixin):
  63. data: List[QuestionItem] = []
  64. class MarkQuestionDetail(DetailMixin):
  65. pass
  66. class UpdateMarkTaskQuestion(BaseModel):
  67. marked_score: float = Field(..., alias="score", description="得分")
  68. marked_img: str = Field(..., alias="img", description="批阅后的试题图片URL")
  69. class Config:
  70. anystr_strip_whitespace = True
  71. class BgUpdateTaskReviewInfo(BaseModel):
  72. high_score: float
  73. avg_score: float
  74. pass_amount: int
  75. pass_rate: float
  76. marked_amount: int
  77. status: Optional[int] = None
  78. class Config:
  79. anystr_strip_whitespace = True
  80. class BgUpdateStudentTaskInfo(BaseModel):
  81. marked_amount: int
  82. is_completed: bool
  83. score: float
  84. objective_score: float = 0
  85. subjective_score: float = 0
  86. editor_id: int
  87. editor_name: str
  88. class Config:
  89. anystr_strip_whitespace = True
  90. class StudentMarkTaskItem(BaseModel):
  91. id: int
  92. student_id: int
  93. student_sno: str
  94. student_name: str
  95. score: float
  96. objective_score: float
  97. subjective_score: float
  98. rank: int = 0
  99. wrong_questions: List[str] = []
  100. class Config:
  101. orm_mode = True
  102. class StudentMarkTaskList(ListMixin):
  103. data: List[StudentMarkTaskItem] = []
  104. class StudentMarkTaskDetail(DetailMixin):
  105. data: StudentMarkTaskItem
  106. class StudentAnswerItem(BaseModel):
  107. qno: str
  108. sqno: str = ""
  109. answer: str
  110. analysis: str
  111. marked_img: str
  112. dist: List[Dict[str, Any]] = []
  113. class StudentAnswerList(ListMixin):
  114. data: List[StudentAnswerItem]
  115. class MarkProcessItem(BaseModel):
  116. qno: str = None
  117. question_amount: int = None
  118. marked_amount: int = None
  119. class MarkProcessList(ListMixin):
  120. data: List[MarkProcessItem] = []