diff --git a/docs/辐射学堂更新日志.txt b/docs/辐射学堂更新日志.txt new file mode 100644 index 0000000..dd4d60c --- /dev/null +++ b/docs/辐射学堂更新日志.txt @@ -0,0 +1,2 @@ +2021-05:增加正式考试参考机会,默认为3次 +2021-05:题目导入时如果题干,题型,分类若在数据库中同时查到一致的,则跳过 \ No newline at end of file diff --git a/test_server/question/views.py b/test_server/question/views.py index 4ed6fc7..738eb80 100644 --- a/test_server/question/views.py +++ b/test_server/question/views.py @@ -202,7 +202,7 @@ class QuestionViewSet(ModelViewSet): else: cateobj = Questioncat.objects.get(id=questioncatdict[questioncat]) if type == '单选': - if Question.objects.filter(type='单选',name=name, is_delete=0).exists(): + if Question.objects.filter(type='单选',name=name, is_delete=0, questioncat=cateobj).exists(): notinlist.append(i) else: if right in ['A','B','C','D','E','F']: @@ -220,7 +220,7 @@ class QuestionViewSet(ModelViewSet): obj.save() elif type == '多选': right = list(right) - if Question.objects.filter(type='多选', name=name, is_delete=0).exists(): + if Question.objects.filter(type='多选', name=name, is_delete=0, questioncat=cateobj).exists(): notinlist.append(i) else: if [False for c in right if c not in qlist]: @@ -243,7 +243,7 @@ class QuestionViewSet(ModelViewSet): right = 'A' else: right = 'B' - if Question.objects.filter(type='判断',name=name, is_delete=0).exists(): + if Question.objects.filter(type='判断',name=name, is_delete=0, questioncat=cateobj).exists(): notinlist.append(i) else: obj = Question()