start end查询参数

This commit is contained in:
caoqianming 2020-11-06 23:32:58 +08:00
parent 4346ee6603
commit f37a2afb27
2 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,5 @@
{% extends "groups/base.html" %} {% extends "groups/base.html" %}
{% load static %}
{% block title %}在线考试统计{% endblock %} {% block title %}在线考试统计{% endblock %}
{% block pagehead %} {% block pagehead %}
@ -9,7 +10,7 @@
</ol> </ol>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% load static %}
<div class="callout callout-warning" style="margin-top: 20px;"> <div class="callout callout-warning" style="margin-top: 20px;">
<h3>在线考试统计</h3> <h3>在线考试统计</h3>
</div> </div>

View File

@ -470,8 +470,8 @@ def examChart(request):#在线考试
def exam_rate(request): def exam_rate(request):
# 考试通过率 # 考试通过率
start = request.GET.get('start') start = request.GET.get('start', None)
end = request.GET.get('end') end = request.GET.get('end', None)
companys = GroupUser.objects.get(id = request.session['user_id']).group.members.all() companys = GroupUser.objects.get(id = request.session['user_id']).group.members.all()
ret = {'x':{'name':'所属公司', 'data':[]}, 's':[{'name':'参考率', 'data':[]},{'name':'满分率', 'data':[]}, {'name':'优秀率', 'data':[]}], 't':'各公司考试比例统计', 'l':['参考率', '满分率', '优秀率']} ret = {'x':{'name':'所属公司', 'data':[]}, 's':[{'name':'参考率', 'data':[]},{'name':'满分率', 'data':[]}, {'name':'优秀率', 'data':[]}], 't':'各公司考试比例统计', 'l':['参考率', '满分率', '优秀率']}
for i in companys: for i in companys:
@ -479,6 +479,10 @@ def exam_rate(request):
user_count = s_models.User.objects.filter(usecomp=i, deletemark=1).count() user_count = s_models.User.objects.filter(usecomp=i, deletemark=1).count()
# 参加考试员工数 # 参加考试员工数
base = s_models.ExamTestDetail.objects.filter(user__usecomp=i, user__deletemark=1, ison=1).exclude(examtest__nousecomps__contains=','+str(i.partid)+',') base = s_models.ExamTestDetail.objects.filter(user__usecomp=i, user__deletemark=1, ison=1).exclude(examtest__nousecomps__contains=','+str(i.partid)+',')
if start:
base = base.filter(examtest__starttime__gte=start)
if end:
base = base.filter(examtest__starttime__lte=end)
testuser_count = base.values('user').distinct().count() testuser_count = base.values('user').distinct().count()
# 参考率 # 参考率
rate1 = testuser_count/user_count rate1 = testuser_count/user_count