kaoshi xiufu
This commit is contained in:
parent
399a8bd32c
commit
b512e3f548
|
@ -0,0 +1,27 @@
|
||||||
|
# Generated by Django 2.2.8 on 2020-03-01 18:35
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('safesite', '0318_auto_20200214_1427'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
# migrations.RemoveField(
|
||||||
|
# model_name='companyinfo',
|
||||||
|
# name='liaison_fax',
|
||||||
|
# ),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='examtestdetail',
|
||||||
|
name='tms',
|
||||||
|
field=models.CharField(default=',', max_length=10000),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='examtestdetail',
|
||||||
|
name='wrongs',
|
||||||
|
field=models.CharField(default=',', max_length=10000),
|
||||||
|
),
|
||||||
|
]
|
|
@ -773,8 +773,8 @@ class ExamTestDetail(models.Model): # 考试详情表
|
||||||
passcode = models.IntegerField(default=0) # 是否通过
|
passcode = models.IntegerField(default=0) # 是否通过
|
||||||
testdetail = JSONField(null=True, blank=True)
|
testdetail = JSONField(null=True, blank=True)
|
||||||
score = models.FloatField(default=0) # 得分
|
score = models.FloatField(default=0) # 得分
|
||||||
tms = models.CharField(max_length=600, default=',')
|
tms = models.CharField(max_length=10000, default=',')
|
||||||
wrongs = models.CharField(max_length=600, default=',')
|
wrongs = models.CharField(max_length=10000, default=',')
|
||||||
|
|
||||||
|
|
||||||
class Train(models.Model): # 培训表
|
class Train(models.Model): # 培训表
|
||||||
|
|
|
@ -4821,125 +4821,70 @@ def apitool(req):
|
||||||
i.took = (i.endtime-i.starttime).total_seconds()
|
i.took = (i.endtime-i.starttime).total_seconds()
|
||||||
i.save()
|
i.save()
|
||||||
return JsonResponse({"code":1})
|
return JsonResponse({"code":1})
|
||||||
elif a == 'correct_testtime':
|
elif a == 'panjuan':
|
||||||
users = User.objects.filter(usecomp__partid=2681)
|
test = ExamTest.objects.get(id=req.GET.get('test'))
|
||||||
objs = ExamTestDetail.objects.filter(testnum__gt=1,user__in=users)
|
answers = ExamPaperDetail.objects.filter(exampaper=test.exampaper).values('id', 'question__right')
|
||||||
print(objs.count())
|
answersdict = {}
|
||||||
for i in objs:
|
for i in answers:
|
||||||
testaddend = ExamTestDetail.objects.filter(user=i.user).exclude(id=i.id)
|
answersdict['paperdetail' + str(i['id'])] = i['question__right']
|
||||||
if testaddend.count() == 2 : # 如果等于两场
|
panjuanlist = ExamTestDetail.objects.filter(examtest=test)
|
||||||
if testaddend[0].took < i.took and testaddend[1].took <i.took:#如果都比这个小
|
num = 0
|
||||||
newtook = round((testaddend[0].took + testaddend[1].took)/2)
|
for obj in panjuanlist:
|
||||||
i.took = newtook
|
tms = []
|
||||||
i.endtime = i.starttime + timedelta(seconds=newtook)
|
wrongs = []
|
||||||
i.testnum = 1
|
rights = 0
|
||||||
i.save()
|
testdetail = obj.testdetail
|
||||||
print('矫正了'+i.user.name + i.examtest.name + str(newtook))
|
if testdetail:
|
||||||
elif testaddend.count() == 1: # 如果参加了一场
|
score = 0
|
||||||
if testaddend[0].took < i.took:
|
for i in testdetail: # 判卷
|
||||||
newtook = round((testaddend[0].took)*0.8)
|
iscore = 0
|
||||||
i.took = newtook
|
i['question__right'] = answersdict['paperdetail'+str(i['id'])]
|
||||||
i.endtime = i.starttime + timedelta(seconds=newtook)
|
if i['question__type'] == 2:
|
||||||
i.testnum = 1
|
if 'userchecked' in i:
|
||||||
i.save()
|
if i['userchecked']:
|
||||||
print('矫正了'+i.user.name + i.examtest.name + str(newtook))
|
if set(i['userchecked']) == set(i['question__right']):
|
||||||
elif a == 'correct_testtime2':
|
iscore = i['score']
|
||||||
users = User.objects.filter(usecomp__partid=2681)
|
rights = rights + 1
|
||||||
for i in users:
|
else:
|
||||||
attends = ExamTestDetail.objects.filter(user=i)
|
miniscore = i['score']/len(i['question__right'])
|
||||||
if attends.count() == 3:
|
wrongs.append(str(i['question__id']))
|
||||||
obj1 = attends.filter(examtest__id=516)[0]
|
for x in i['userchecked']:
|
||||||
obj2 = attends.filter(examtest__id=517)[0]
|
if x in i['question__right']:
|
||||||
obj3 = attends.filter(examtest__id=526)[0]
|
iscore = iscore + miniscore
|
||||||
if obj1.took<obj2.took and obj1.took<obj3.took and obj2.took>1790 and obj3.took>1790:
|
else:
|
||||||
newtook2 = round((obj1.took)*0.9)
|
iscore = 0
|
||||||
newtook3 = round((obj1.took)*0.8)
|
break
|
||||||
obj2.took = newtook2
|
else:
|
||||||
obj2.endtime = obj2.starttime + timedelta(seconds=newtook2)
|
if 'userchecked' in i:
|
||||||
obj2.testnum = 1
|
if i['userchecked']:
|
||||||
obj2.save()
|
if i['userchecked'] == i['question__right']:
|
||||||
print('矫正了'+ obj2.user.name + obj2.examtest.name + str(newtook2))
|
iscore = i['score']
|
||||||
obj3.took = newtook3
|
rights = rights + 1
|
||||||
obj3.endtime = obj3.starttime + timedelta(seconds=newtook3)
|
else:
|
||||||
obj3.testnum = 1
|
wrongs.append(str(i['question__id']))
|
||||||
obj3.save()
|
i['iscore'] = iscore
|
||||||
print('矫正了'+ obj3.user.name + obj3.examtest.name + str(newtook3))
|
score = score + iscore
|
||||||
elif obj3.took >= 1798 and obj2.took < 1798 and obj1.took < 1798:
|
tms.append(str(i['question__id']))
|
||||||
newtook = round((obj2.took + obj1.took)/2)
|
obj.testdetail = testdetail
|
||||||
obj3.took = newtook
|
obj.rights = rights
|
||||||
obj3.endtime = obj3.starttime + timedelta(seconds=newtook)
|
score = round(score,1)
|
||||||
obj3.testnum = 1
|
obj.score = score
|
||||||
obj3.save()
|
obj.ison = 1
|
||||||
print('矫正了'+ obj3.user.name + obj3.examtest.name + str(newtook))
|
totalscore = test.totalscore
|
||||||
elif obj2.took >= 1798 and obj1.took < 1798 and obj3.took < 1798:
|
passscore = test.passscore
|
||||||
newtook = round((obj3.took + obj1.took)/2)
|
if score >= passscore:
|
||||||
obj2.took = newtook
|
passcode = 1
|
||||||
obj2.endtime = obj2.starttime + timedelta(seconds=newtook)
|
else:
|
||||||
obj2.testnum = 1
|
passcode = 0
|
||||||
obj2.save()
|
obj.passcode = passcode
|
||||||
print('矫正了'+ obj2.user.name + obj2.examtest.name + str(newtook))
|
if tms:
|
||||||
elif obj1.took >= 1798 and obj2.took < 1798 and obj3.took < 1798:
|
obj.tms = ','+','.join(tms)+','
|
||||||
newtook = round((obj3.took + obj1.took)/2)
|
if wrongs:
|
||||||
obj2.took = newtook
|
obj.wrongs = ','+','.join(wrongs)+','
|
||||||
obj2.endtime = obj2.starttime + timedelta(seconds=newtook)
|
obj.save()
|
||||||
obj2.testnum = 1
|
num = num + 1
|
||||||
obj2.save()
|
print(str(num) + obj.user.name + '得分' + str(score))
|
||||||
print('矫正了'+ obj2.user.name + obj2.examtest.name + str(newtook))
|
return JsonResponse({"code":1})
|
||||||
elif attends.count() == 1:
|
|
||||||
obj = attends[0]
|
|
||||||
if obj.took > 1798:
|
|
||||||
obj.took = 1801
|
|
||||||
obj.endtime = obj.starttime + timedelta(seconds=1798)
|
|
||||||
obj.testnum=1
|
|
||||||
obj.save()
|
|
||||||
print('矫正了'+ obj.user.name + obj.examtest.name)
|
|
||||||
elif attends.count() == 2:
|
|
||||||
obj1 = attends[0]
|
|
||||||
obj2 = attends[1]
|
|
||||||
if obj1.took < 1795 < obj2.took:
|
|
||||||
newtook = round((obj1.took)*0.8)
|
|
||||||
obj2.took = newtook
|
|
||||||
obj2.endtime = obj2.starttime + timedelta(seconds=newtook)
|
|
||||||
obj2.testnum=1
|
|
||||||
obj2.save()
|
|
||||||
print('矫正了'+ obj2.user.name + obj2.examtest.name)
|
|
||||||
elif obj2.took < 1795 < obj1.took:
|
|
||||||
newtook = round((obj2.took)*0.8)
|
|
||||||
obj1.took = newtook
|
|
||||||
obj1.endtime = obj1.starttime + timedelta(seconds=newtook)
|
|
||||||
obj1.testnum=1
|
|
||||||
obj1.save()
|
|
||||||
print('矫正了'+ obj1.user.name + obj1.examtest.name)
|
|
||||||
|
|
||||||
elif a == 'correct_testtime3':
|
|
||||||
objs = ExamTestDetail.objects.filter(user__usecomp=2681,testnum__gt=1)
|
|
||||||
for i in objs:
|
|
||||||
if i.took < 1798:
|
|
||||||
i.testnum=1
|
|
||||||
i.save()
|
|
||||||
else:
|
|
||||||
i.took = 1799
|
|
||||||
i.endtime = i.starttime + timedelta(seconds=1799)
|
|
||||||
i.testnum = 1
|
|
||||||
i.save()
|
|
||||||
elif a == 'correct_testtime4':
|
|
||||||
objs = ExamTestDetail.objects.filter(user__usecomp=2681,testnum__gt=1)
|
|
||||||
for i in objs:
|
|
||||||
if i.took < 1798:
|
|
||||||
i.testnum=1
|
|
||||||
i.save()
|
|
||||||
else:
|
|
||||||
i.took = 1799
|
|
||||||
i.endtime = i.starttime + timedelta(seconds=1799)
|
|
||||||
i.testnum = 1
|
|
||||||
i.save()
|
|
||||||
elif a == 'correct_testtime5':
|
|
||||||
objs = ExamTestDetail.objects.filter(user__usecomp=2681,took__gt=1800)
|
|
||||||
for i in objs:
|
|
||||||
i.took = 1801
|
|
||||||
i.endtime = i.starttime + timedelta(seconds=1801)
|
|
||||||
i.testnum = 1
|
|
||||||
i.save()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue