From 489ab609f47405ab45b3f6bcfbd50f52b8e34465 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sat, 8 May 2021 14:57:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=98=E7=9B=AE=E5=AF=BC=E5=85=A5=E6=97=B6?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E9=A2=98=E5=B9=B2=EF=BC=8C=E9=A2=98=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E5=88=86=E7=B1=BB=E8=8B=A5=E5=9C=A8=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E4=B8=AD=E5=90=8C=E6=97=B6=E6=9F=A5=E5=88=B0=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E7=9A=84=EF=BC=8C=E5=88=99=E8=B7=B3=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/辐射学堂更新日志.txt | 2 ++ test_server/question/views.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 docs/辐射学堂更新日志.txt 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()