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