add: 出具培训证书

This commit is contained in:
zty 2024-05-30 13:41:22 +08:00
parent 61f9085f34
commit 3ea6d72ae0
1 changed files with 0 additions and 6 deletions

View File

@ -261,7 +261,6 @@ class PaperViewSet(ModelViewSet):
sr.is_valid(raise_exception=True)
vdata = sr.validated_data
questions_ = vdata.pop('questions_')
print(questions_, '')
vdata['update_by'] = request.user
Paper.objects.filter(id=paper.id).update(**vdata)
q_list = []
@ -343,7 +342,6 @@ class PaperViewSet(ModelViewSet):
id=questioncatdict[questioncat])
if Question.objects.filter(name=name, is_deleted=0, questioncat=cateobj).exists():
ids.append(Question.objects.get(name=name, is_deleted=0, questioncat=cateobj).id)
print(ids, '已存在')
i = i + 1
continue
if type == '单选':
@ -402,7 +400,6 @@ class PaperViewSet(ModelViewSet):
i = i + 1
else:
raise ParseError('excel解析失败')
print(ids, "--------------------")
if ids:
questions = Question.objects.filter(pk__in=ids)
Serializer = QuestionSerializer(questions, many=True)
@ -569,12 +566,10 @@ class ExamRecordViewSet(ListModelMixin, DestroyModelMixin, RetrieveModelMixin, G
for index, ad in enumerate(ads):
ad.user_answer = questions_[index]['user_answer']
if ad.question.type == '多选':
print('多选', ad.question.right, ad.user_answer)
if set(ad.question.right) == set(ad.user_answer):
ad.is_right = True
ad.score = ad.total_score
else:
print('其他', ad.question.right, ad.user_answer)
if ad.question.right == ad.user_answer:
ad.is_right = True
ad.score = ad.total_score
@ -584,7 +579,6 @@ class ExamRecordViewSet(ListModelMixin, DestroyModelMixin, RetrieveModelMixin, G
raise ParseError('判卷失败, 请检查试卷:' + str(e))
er.score = total_score
# if er.score > 0.6*er.total_score:
print('score:', er.score, 'paper_socre',paper.pass_score)
if er.score >= paper.pass_score:
er.is_pass = True
# 如果是自动发证