diff --git a/groups/templates/groups/exam.html b/groups/templates/groups/exam.html
index a7106952..f9a315d3 100644
--- a/groups/templates/groups/exam.html
+++ b/groups/templates/groups/exam.html
@@ -1,4 +1,5 @@
{% extends "groups/base.html" %}
+{% load static %}
{% block title %}在线考试统计{% endblock %}
{% block pagehead %}
@@ -9,7 +10,7 @@
{% endblock %}
{% block content %}
-{% load static %}
+
在线考试统计
diff --git a/groups/views.py b/groups/views.py
index 19b031bb..28d5549c 100644
--- a/groups/views.py
+++ b/groups/views.py
@@ -470,8 +470,8 @@ def examChart(request):#在线考试
def exam_rate(request):
# 考试通过率
- start = request.GET.get('start')
- end = request.GET.get('end')
+ start = request.GET.get('start', None)
+ end = request.GET.get('end', None)
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':['参考率', '满分率', '优秀率']}
for i in companys:
@@ -479,6 +479,10 @@ def exam_rate(request):
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)+',')
+ 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()
# 参考率
rate1 = testuser_count/user_count