集团考试比率增加左侧集团总计
This commit is contained in:
parent
f41076b713
commit
c49eca8dc6
|
@ -73,7 +73,7 @@ desired effect
|
||||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||||
<!-- <span class="logo-mini"><b>A</b>LT</span> -->
|
<!-- <span class="logo-mini"><b>A</b>LT</span> -->
|
||||||
<!-- logo for regular state and mobile devices -->
|
<!-- logo for regular state and mobile devices -->
|
||||||
<span class="logo-lg"><b>集团后台</b></span>
|
<span class="logo-lg"><b>{{ request.session.user_groupname }}</b></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- Header Navbar -->
|
<!-- Header Navbar -->
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
{% extends "groups/base.html" %}
|
{% extends "groups/base.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
{% block headother%}
|
||||||
|
<link rel="stylesheet" href="{% static 'groups/bower_components/layer/theme/default/layer.css' %}">
|
||||||
|
<link rel="stylesheet" href="{% static 'groups/bower_components/bootstrap-table/bootstrap-table.min.css' %}">
|
||||||
|
<script src="{% static 'groups/time/laydate/laydate.js' %}"></script>
|
||||||
|
<link rel="stylesheet" href="{% static 'groups/time/laydate/theme/default/laydate.css' %}">
|
||||||
|
<script src="{% static 'groups/plugins/iCheck/icheck.min.js' %}"></script>
|
||||||
|
<script src="{% static 'groups/bower_components/echarts.min.js' %}"></script>
|
||||||
|
{% endblock %}
|
||||||
{% block title %}在线考试统计{% endblock %}
|
{% block title %}在线考试统计{% endblock %}
|
||||||
{% block pagehead %}
|
{% block pagehead %}
|
||||||
|
|
||||||
|
@ -25,16 +32,6 @@
|
||||||
<div style="background-color:#dac2a3;margin-top:10px">
|
<div style="background-color:#dac2a3;margin-top:10px">
|
||||||
<div id="examChart2" style="width:100%;height:500px;margin:auto"></div>
|
<div id="examChart2" style="width:100%;height:500px;margin:auto"></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- jQuery 3 -->
|
|
||||||
<script src="{% static 'groups/bower_components/jquery/dist/jquery.min.js' %}"></script>
|
|
||||||
<!-- Bootstrap 3.3.7 -->
|
|
||||||
<script src="{% static 'groups/bower_components/bootstrap/dist/js/bootstrap.min.js' %}"></script>
|
|
||||||
|
|
||||||
<script src="{% static 'groups/time/laydate/laydate.js' %}"></script>
|
|
||||||
<link rel="stylesheet" href="{% static 'groups/time/laydate/theme/default/laydate.css' %}">
|
|
||||||
<!-- iCheck -->
|
|
||||||
<script src="{% static 'groups/plugins/iCheck/icheck.min.js' %}"></script>
|
|
||||||
<script src="{% static 'groups/bower_components/echarts.min.js' %}"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//隐患数量趋势图
|
//隐患数量趋势图
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ def login(request):
|
||||||
request.session['is_login'] = True
|
request.session['is_login'] = True
|
||||||
request.session['user_id'] = user.id
|
request.session['user_id'] = user.id
|
||||||
request.session['user_name'] = user.username
|
request.session['user_name'] = user.username
|
||||||
|
request.session['user_groupname'] = user.group.groupname
|
||||||
if user.issuper==1:
|
if user.issuper==1:
|
||||||
request.session['issuper'] = True #是否是超级管理员
|
request.session['issuper'] = True #是否是超级管理员
|
||||||
return redirect('/groups/index/')
|
return redirect('/groups/index/')
|
||||||
|
@ -473,8 +474,13 @@ def exam_rate(request):
|
||||||
# 考试通过率
|
# 考试通过率
|
||||||
start = request.GET.get('start', None)
|
start = request.GET.get('start', None)
|
||||||
end = request.GET.get('end', None)
|
end = request.GET.get('end', None)
|
||||||
companys = GroupUser.objects.get(id = request.session['user_id']).group.members.all()
|
groupuser = GroupUser.objects.get(id = request.session['user_id'])
|
||||||
|
companys = groupuser.group.members.all()
|
||||||
ret = {'x':{'name':'所属公司', 'data':[]}, 's':[{'name':'参考率', 'data':[]},{'name':'优秀率', 'data':[]}, {'name':'满分率', 'data':[]}], 't':'各公司考试比例统计'}
|
ret = {'x':{'name':'所属公司', 'data':[]}, 's':[{'name':'参考率', 'data':[]},{'name':'优秀率', 'data':[]}, {'name':'满分率', 'data':[]}], 't':'各公司考试比例统计'}
|
||||||
|
user_count_t = 0
|
||||||
|
testuser_count_t = 0
|
||||||
|
full_count_t = 0
|
||||||
|
ninety_count_t = 0
|
||||||
for i in companys:
|
for i in companys:
|
||||||
# 员工数
|
# 员工数
|
||||||
user_count = s_models.User.objects.filter(usecomp=i, deletemark=1).count()
|
user_count = s_models.User.objects.filter(usecomp=i, deletemark=1).count()
|
||||||
|
@ -489,7 +495,7 @@ def exam_rate(request):
|
||||||
# 参考率
|
# 参考率
|
||||||
rate1 = testuser_count/user_count
|
rate1 = testuser_count/user_count
|
||||||
# 考试总数
|
# 考试总数
|
||||||
test_count = base.count()
|
# test_count = base.count()
|
||||||
# 满分人数
|
# 满分人数
|
||||||
full_count = base.filter(score__gte= F('examtest__totalscore')).values('user').distinct().count()
|
full_count = base.filter(score__gte= F('examtest__totalscore')).values('user').distinct().count()
|
||||||
# 满分率
|
# 满分率
|
||||||
|
@ -506,6 +512,17 @@ def exam_rate(request):
|
||||||
ret['s'][0]['data'].append(rate1)
|
ret['s'][0]['data'].append(rate1)
|
||||||
ret['s'][1]['data'].append(rate3)
|
ret['s'][1]['data'].append(rate3)
|
||||||
ret['s'][2]['data'].append(rate2)
|
ret['s'][2]['data'].append(rate2)
|
||||||
|
user_count_t = user_count_t + user_count
|
||||||
|
testuser_count_t = testuser_count_t + testuser_count
|
||||||
|
full_count_t = full_count_t + full_count
|
||||||
|
ninety_count_t = ninety_count_t + ninety_count
|
||||||
|
rate1_t = testuser_count_t/user_count_t
|
||||||
|
rate2_t = full_count_t/user_count_t if user_count_t else 0
|
||||||
|
rate3_t = ninety_count_t/user_count_t if user_count_t else 0
|
||||||
|
ret['x']['data'].insert(0, groupuser.group.groupname)
|
||||||
|
ret['s'][0]['data'].insert(0, int(rate1_t*100+0.5))
|
||||||
|
ret['s'][1]['data'].insert(0, int(rate3_t*100+0.5))
|
||||||
|
ret['s'][2]['data'].insert(0, int(rate2_t*100+0.5))
|
||||||
return HttpResponse(json.dumps({'code':200,'data':ret}), content_type='application/json')
|
return HttpResponse(json.dumps({'code':200,'data':ret}), content_type='application/json')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue