dev_partners
Alec Zhou 6 years ago
commit 256e6021f4

@ -97,9 +97,12 @@ class CollegesController < ApplicationController
shixun_ids = HomeworkCommonsShixuns.find_by_sql("SELECT hcs.shixun_id FROM homework_commons_shixuns hcs, homework_commons hc
WHERE hc.course_id in (#{all_course_ids.map(&:id).join(',').strip == "" ? -1 : all_course_ids.map(&:id).join(',')})
AND hcs.homework_common_id = hc.id").map(&:shixun_id)
shixun_tags = TagRepertoire.find_by_sql("SELECT tr.`name`, COUNT(str.shixun_id) as shixun_count FROM tag_repertoires tr, shixun_tag_repertoires str WHERE tr.id = str.tag_repertoire_id AND str.shixun_id IN (#{shixun_ids.join(',').strip == "" ? -1 : shixun_ids.join(',')}) GROUP BY tr.id order by shixun_count desc")
shixun_tags = TagRepertoire.find_by_sql("SELECT tr.`name`, COUNT(str.shixun_id) as shixun_count FROM tag_repertoires tr,
shixun_tag_repertoires str WHERE tr.id = str.tag_repertoire_id AND str.shixun_id
IN (#{shixun_ids.join(',').strip == "" ? -1 : shixun_ids.join(',')}) GROUP BY tr.id
order by shixun_count desc")
all_shixun_count = shixun_tags.map(&:shixun_count).sum
other_count = all_shixun_count - shixun_tags[0..8].map(&:shixun_count).sum
other_count = all_shixun_count.to_i - shixun_tags[0..8].map(&:shixun_count).sum.to_i
@shixun_tags_name = []
@shixun_tags_data = []
shixun_tags[0..8].each do |tag|
@ -254,7 +257,7 @@ class CollegesController < ApplicationController
def manager_auth
# unless (User.current.admin? || DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present?)
unless (User.current.admin? ||
unless (User.current.admin? || User.current.business? ||
DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present? ||
(User.current.user_extensions.try(:school_id) == @department.school_id && User.current.user_extensions.try(:identity) == 0) ||
(@department.school.try(:customer_id) && User.current.try(:partner).try(:customer_ids) && User.current.try(:partner).try(:customer_ids).include?(@department.school.try(:customer_id))))

@ -218,7 +218,7 @@ class WelcomeController < ApplicationController
@tea_users = User.where(homepage_teacher: 1).includes(:user_extensions).limit(10).order("experience desc")
@stu_users = User.includes(:user_extensions).where(user_extensions: {identity: 1}).limit(10).order("experience desc")
render :layout => 'base_local'
render :layout => 'educoder'
end
# 自动导入用户

@ -27,7 +27,9 @@ class Management::SchoolDataContrastService
reports = reports.group(:school_id)
count = reports.count.count
[count, SchoolDailyReport.find_by_sql(query_report_sql(reports.to_sql))]
reports = reports.limit(PAGE_SIZE).offset(offset)
[count, reports]
end
private
@ -55,12 +57,9 @@ class Management::SchoolDataContrastService
def select_columns
"school_id, school_name,"\
"SUM(IF(date BETWEEN '#{format_date(params[:begin_date])}' AND '#{format_date(params[:end_date])}', #{contrast_column}, 0)) total,"\
"SUM(IF(date BETWEEN '#{format_date(params[:other_begin_date])}' AND '#{format_date(params[:other_end_date])}', #{contrast_column}, 0)) other_total"
end
def query_report_sql(from_sql)
"SELECT reports.*, (other_total - total) increase, (IF(other_total - total = 0, 0.0, round((other_total - total) / IF(total = 0, 1, total), 5))) percentage "\
"FROM (#{from_sql}) reports ORDER BY percentage #{sort_direction} LIMIT #{PAGE_SIZE} OFFSET #{offset}"
"(@total:=SUM(IF(date BETWEEN '#{format_date(params[:begin_date])}' AND '#{format_date(params[:end_date])}', #{contrast_column}, 0))) total,"\
"(@other_total:=SUM(IF(date BETWEEN '#{format_date(params[:other_begin_date])}' AND '#{format_date(params[:other_end_date])}', #{contrast_column}, 0))) other_total,"\
"(IF(@other_total - @total = 0, 0.0, round((@other_total - @total) / IF(@total = 0, 1, @total), 5))) percentage,"\
"(@other_total - @total) increase"
end
end

@ -7,23 +7,43 @@
<meta name="keywords" content="智能课堂,实训项目" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'css/font-awesome','educoder/edu-main','educoder/edu-all','/assets/iconfont/iconfont.css', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/font-awesome','educoder/edu-main','educoder/edu-all','educoder/magic-check.css','/assets/iconfont/iconfont.css', :media => 'all' %> <%= javascript_heads %>
<%= javascript_include_tag 'edu/application', 'educoder/edu_application','educoder/edu_account',"educoder/edu_user" %>
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<body onload="prettyPrint();">
<div class="newContainer">
<div class="newHeader" id="nHeader">
<%= render :partial => 'layouts/logined_header' %>
<div class="newContainer"> <!-- 页面全部内容 -->
<div class="newHeader" id="nHeader"> <!-- 头部 -->
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
<div class="cl"></div>
</div>
<div class="newMain clearfix">
<div class="newMain clearfix"> <!-- 主提部分 -->
<div id="Container">
<%= yield %>
</div>
<div class="cl"></div>
<!-------------------侧边提示区域-------------------------->
<%= render :partial => 'users/returnTop_btn' %>
</div>
<!----------------------左侧导航栏 ------------------------->
<%#= render :partial => 'layouts/public_left_info' %>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<div id="ajax-modal" style="display:none;"></div>
@ -35,6 +55,4 @@
</div>
</div>
</body>
<%= javascript_heads_local %>
<%= javascript_include_tag 'edu/application', 'educoder/edu_application',"educoder/edu_user" %>
</html>

@ -17,7 +17,8 @@
<th width="24%">时段一<br><%= "#{params[:begin_date]}至#{params[:end_date]}" %></th>
<th width="24%">时段二<br><%= "#{params[:other_begin_date]}至#{params[:other_end_date]}" %></th>
<th width="16%" colspan="2">
<%= sort_tag('变化情况', name: 'percentage', path: school_data_contrast_managements_path) %>
<%#= sort_tag('变化情况', name: 'percentage', path: school_data_contrast_managements_path) %>
变化情况
<br> 新 增 数 | 新增百分比)
</th>
</tr>

@ -187,8 +187,8 @@
<li class="clearfix mb10">
<label class="panel-form-label fl mr18">运营人员:</label>
<span class="fl">
<input type="checkbox" <%= @user.business ? "checked" : "" %> name="business" value="<%= @user.business? ? 1 : 0 %>" id="person_9" class="magic-checkbox" style="float:left; margin-top: 8px;">
<label for="person_9"></label>
<input type="checkbox" <%= @user.business? ? "checked" : "" %> name="business" value="<%= @user.business? ? "1" : "0" %>" id="person_business" class="magic-checkbox" style="float:left; margin-top: 8px;">
<label for="person_business"><%= @user.business? %></label>
</span>
</li>
<li class="clearfix mb10 hascontont">

Loading…
Cancel
Save