获取问题列表 :param with_valid: 是否校验 :return: 问题列表
(self, with_valid=False)
| 114 | raise AppApiException(500, _("Paragraph id does not exist")) |
| 115 | |
| 116 | def list(self, with_valid=False): |
| 117 | """ |
| 118 | 获取问题列表 |
| 119 | :param with_valid: 是否校验 |
| 120 | :return: 问题列表 |
| 121 | """ |
| 122 | if with_valid: |
| 123 | self.is_valid(raise_exception=True) |
| 124 | problem_paragraph_mapping = QuerySet(ProblemParagraphMapping).filter( |
| 125 | knowledge_id=self.data.get("knowledge_id"), paragraph_id=self.data.get("paragraph_id") |
| 126 | ) |
| 127 | return [ |
| 128 | ProblemSerializer(row).data |
| 129 | for row in QuerySet(Problem).filter(id__in=[row.problem_id for row in problem_paragraph_mapping]) |
| 130 | ] |
| 131 | |
| 132 | @transaction.atomic |
| 133 | def save(self, instance: Dict, with_valid=True, with_embedding=True, embedding_by_problem=None): |
nothing calls this directly
no test coverage detected