部门排名 part

This commit is contained in:
caoqianming 2020-02-25 14:13:56 +08:00
parent 66d3730917
commit 89123441ec
1 changed files with 3 additions and 2 deletions

View File

@ -15,7 +15,7 @@ from uuid import UUID
import os
import time
from datetime import datetime, date, timedelta
from django.db.models import F, Count, Sum
from django.db.models import F, Count, Sum, Avg
import requests
from .tasks import send_wechatmsgs, send_wechatmsg, yjjs, gettime, yjjs_px, yjjs_yl, updateTzzs, updateAqzs, yjjs_gc, yjjs_ws
from .export import exportdoc, exportxlsx, exportyjdoc, exportsimplexlsx, exportdoc2
@ -6204,8 +6204,9 @@ def apiexamtestrate(req):
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'))
with open('ratedata.dat','wb') as f:
pickle.dump({'total':total,'rows':objslist,'updatetime':datetime.now().strftime('%Y-%m-%d %H:%M')},f)
pickle.dump({'total':total,'rows':objslist,'rows2':list(orgsCal),'updatetime':datetime.now().strftime('%Y-%m-%d %H:%M')},f)
return JsonResponse({"code": 1})