考试提交ison bug

This commit is contained in:
caoqianming 2020-11-30 21:42:23 +08:00
parent e6b8043a6c
commit 898c402a25
1 changed files with 3 additions and 6 deletions

View File

@ -6452,14 +6452,13 @@ def apiexamtestdetail(req):
examtestobj = ExamTest.objects.get(id=testid)
obj,created = ExamTestDetail.objects.get_or_create(examtest = examtestobj, user__userid=userid,
defaults={'examtest': examtestobj,'user':User.objects.get(userid=userid)})
obj.ison = 1
starttime = data['starttime']
endtime = datetime.now()
took = (endtime - datetime.strptime(starttime, '%Y-%m-%d %H:%M:%S')).total_seconds() #计算相差多少秒
# if 'took' in data:
# if data['took']<took:
# took = data['took']
testdetail = data['sheet']
obj.ison = 1
obj.testdetail = testdetail
obj.save()
score = 0
rights = 0
tms = []
@ -6501,11 +6500,9 @@ def apiexamtestdetail(req):
obj.starttime = starttime
obj.endtime = endtime
obj.took = took
obj.testdetail = testdetail
obj.rights = rights
score = round(score,1)
obj.score = score
obj.ison = 1
examtestobj = obj.examtest
totalscore = examtestobj.totalscore
passscore = examtestobj.passscore