机构排名

This commit is contained in:
caoqianming 2020-02-25 18:30:38 +08:00
parent ed10ef1260
commit fe44b5d492
5 changed files with 16 additions and 8 deletions

Binary file not shown.

View File

@ -146,7 +146,7 @@
<p class="_p">
<a class="list" href="javascript:;">
<input id="file" type="file" name="myfile" accept=".xls,.ppt,.doc,.pdf,.rar,.zip,.pptx,.docx,.xlsx" onchange="UpladFile(this); " /><span>选择文件</span>
<input id="file" type="file" name="myfile" accept=".xls,.ppt,.doc,.pdf,.rar,.zip,.pptx,.docx,.xlsx,.mp4" onchange="UpladFile(this); " /><span>选择文件</span>
</a>
<!--<button class="btn" type="button" onclick="sub();">上传</button>-->
<a class="el-upload-list__item-name">
@ -241,7 +241,7 @@ $("#cate").treegrid("unselect");
};
var filetypes = [".xls",".txt",".ppt",".doc",".pdf",".dot",".rar",".zip",".docx", ".pptx", ".xlsx"];
var filetypes = [".xls",".txt",".ppt",".doc",".pdf",".dot",".rar",".zip",".docx", ".pptx", ".xlsx", ".mp4"];
var filepath = target.value;
if (filepath) {
var isnext = false;

View File

@ -33,7 +33,7 @@
</div>
<div style="margin-bottom:5px;">
<input id="endtime" editable="false" name="endtime" class="easyui-datetimebox" style="width:90%"
data-options="label:'最迟参加',currentText:'今天',closeText:'关闭',showSeconds: false" />
data-options="label:'最迟参加',currentText:'今天',closeText:'关闭',showSeconds: false,required:true" />
</div>
<div style="margin-bottom:5px">
<input class="easyui-textbox" id="participantname" style="width:80%;height:120px" editable="false"

View File

@ -39,7 +39,7 @@
</div>
<div style="margin-bottom:5px;">
<input id="endtime" editable="false" name="endtime" class="easyui-datetimebox" style="width:90%"
data-options="label:'考试结束',currentText:'今天',closeText:'关闭',showSeconds: false" />
data-options="label:'考试结束',currentText:'今天',closeText:'关闭',showSeconds: false,required:true" />
</div>
<div style="margin-bottom:5px">
<input class="easyui-textbox" id="participantname" style="width:90%;height:120px" editable="false"

View File

@ -6329,15 +6329,23 @@ def apiexamtestrate(req):
'''
companyid = req.GET.get('companyid')
alltest = ExamTest.objects.filter(usecomps__contains=','+str(companyid)+',').exclude(nousecomps__contains=','+str(companyid)+',')
print(alltest)
objs = ExamTestDetail.objects.filter(examtest__in=alltest,ison=1).values('user__userid','user__name','user__headimgurl','user__ubelongpart__partname').annotate(totalscore=Sum('score'),totaltook=Sum('took'),testnum=Count('user__userid')).order_by('-totalscore','totaltook')
allexamtestdetail = ExamTestDetail.objects.filter(examtest__in=alltest,ison=1)
objs = allexamtestdetail.values('user__userid','user__name','user__headimgurl','user__ubelongpart__partname').annotate(totalscore=Sum('score'),totaltook=Sum('took'),testnum=Count('user__userid')).order_by('-totalscore','totaltook')
total = objs.count()
objslist = list(objs)
for i in objslist:
i['rate'] = objslist.index(i) + 1
orgsCal = ExamTestDetail.objects.filter(examtest__in=alltest,ison=1,score>0).values('user__ubelongpart__partid','user__ubelongpart__partname').annotate(totaltest=Count('user__ubelongpart__partid'),avgscore=Avg('score'),totaluser=Count('user__userid'))
i['avgscore'] = round(i['totalscore']/i['testnum'],1)
orgsCal = allexamtestdetail.filter(score__gt=0).values('user__ubelongpart__partid','user__ubelongpart__partname').annotate(totaltest=Count('user__ubelongpart__partid'),avgscore=Avg('score')).order_by('-totaltest','-avgscore')
allattenduser = allexamtestdetail.values_list('user__userid', flat=True)
orgsCallist = list(orgsCal)
for i in orgsCallist:
users = User.objects.filter(ubelongpart__partid=i['user__ubelongpart__partid'])
usersattend = users.filter(userid__in=allattenduser)
i['totaluser'] = usersattend.count()
i['avgscore'] = round(i['avgscore'],1)
with open('ratedata.dat','wb') as f:
pickle.dump({'total':total,'rows':objslist,'rows2':list(orgsCal),'updatetime':datetime.now().strftime('%Y-%m-%d %H:%M')},f)
pickle.dump({'total':total,'rows':objslist,'rows2':orgsCallist,'updatetime':datetime.now().strftime('%Y-%m-%d %H:%M')},f)
return JsonResponse({"code": 1})