dr question

This commit is contained in:
caoqianming 2020-09-25 08:56:54 +08:00
parent 82ed58a50b
commit e7e223a83c
1 changed files with 3 additions and 5 deletions

View File

@ -93,10 +93,9 @@ def drquestions(companyid,path,userid):
cateobj = objs[0] cateobj = objs[0]
else: else:
cateobj = Questioncat.objects.create(usecomp=Partment.objects.get(partid=companyid),name=cate) cateobj = Questioncat.objects.create(usecomp=Partment.objects.get(partid=companyid),name=cate)
print(cateobj)
if type == '单选': if type == '单选':
if Question.objects.filter(type=1,title=title,right=right,deletemark=1,usecomps = ','+companyid+',').exists(): if Question.objects.filter(type=1,title=title,right=right,deletemark=1,usecomps = ','+companyid+',').exists():
notinlist.append(i) Question.objects.filter(type=1,title=title,right=right,deletemark=1,usecomps = ','+companyid+',').update(nousecomps='')
else: else:
if right in ['A','B','C','D','E','F']: if right in ['A','B','C','D','E','F']:
obj = Question() obj = Question()
@ -116,7 +115,7 @@ def drquestions(companyid,path,userid):
elif type == '多选': elif type == '多选':
right = list(right) right = list(right)
if Question.objects.filter(type=2,title=title,right=right,deletemark=1,usecomps = ','+companyid+',').exists(): if Question.objects.filter(type=2,title=title,right=right,deletemark=1,usecomps = ','+companyid+',').exists():
notinlist.append(i) Question.objects.filter(type=2,title=title,right=right,deletemark=1,usecomps = ','+companyid+',').update(nousecomps='')
else: else:
if [False for c in right if c not in qlist]: if [False for c in right if c not in qlist]:
pass pass
@ -141,7 +140,7 @@ def drquestions(companyid,path,userid):
else: else:
right = 'B' right = 'B'
if Question.objects.filter(type=3,title=title,right=right,deletemark=1,usecomps = ','+companyid+',').exists(): if Question.objects.filter(type=3,title=title,right=right,deletemark=1,usecomps = ','+companyid+',').exists():
notinlist.append(i) Question.objects.filter(type=3,title=title,right=right,deletemark=1,usecomps = ','+companyid+',').update(nousecomps='')
else: else:
obj = Question() obj = Question()
obj.type = 3 obj.type = 3
@ -158,7 +157,6 @@ def drquestions(companyid,path,userid):
obj.createuser = user obj.createuser = user
obj.save() obj.save()
i = i +1 i = i +1
print(notinlist)
return notinlist return notinlist
def drtodotroubles(companyid,path,userid): def drtodotroubles(companyid,path,userid):