dev_trainings
cxt 6 years ago
commit afc01ad67b

@ -83,11 +83,11 @@ class Management::SchoolReportService
.select("#{base_query_column}, COUNT(*) student_count") .select("#{base_query_column}, COUNT(*) student_count")
when 'homework_count' then when 'homework_count' then
schools.joins('LEFT JOIN courses ON courses.school_id = schools.id') schools.joins('LEFT JOIN courses ON courses.school_id = schools.id')
.joins('LEFT JOIN homework_commons hc ON shc.course_id = courses.id AND hc.homework_type = 4') .joins('LEFT JOIN homework_commons hc ON hc.course_id = courses.id AND hc.homework_type = 4')
.select("#{base_query_column}, COUNT(*) homework_count") .select("#{base_query_column}, COUNT(*) homework_count")
when 'other_homework_count' then when 'other_homework_count' then
schools.joins('LEFT JOIN courses ON courses.school_id = schools.id') schools.joins('LEFT JOIN courses ON courses.school_id = schools.id')
.joins('LEFT JOIN homework_commons hc ON shc.course_id = courses.id AND hc.homework_type IN (1, 3)') .joins('LEFT JOIN homework_commons hc ON hc.course_id = courses.id AND hc.homework_type IN (1, 3)')
.select("#{base_query_column}, COUNT(*) other_homework_count") .select("#{base_query_column}, COUNT(*) other_homework_count")
when 'course_count' then when 'course_count' then
schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0') schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0')

@ -21,8 +21,8 @@
<th width="6%">序号</th> <th width="6%">序号</th>
<th width="10%">ID</th> <th width="10%">ID</th>
<th width="20%" class="edu-txt-left">单位名称</th> <th width="20%" class="edu-txt-left">单位名称</th>
<th width="22%">时段一<br><%= "#{params[:begin_date]} 05:00至#{params[:end_date]} 05:00" %></th> <th width="22%">时段一<br><%= "#{params[:begin_date]} 05:00至#{(Time.zone.parse(params[:end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00" %></th>
<th width="22%">时段二<br><%= "#{params[:other_begin_date]} 05:00至#{params[:other_end_date]} 05:00" %></th> <th width="22%">时段二<br><%= "#{params[:other_begin_date]} 05:00至#{(Time.zone.parse(params[:other_end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00" %></th>
<th width="20%" colspan="2"> <th width="20%" colspan="2">
<%= sort_tag('变化情况', name: 'percentage', path: school_data_contrast_managements_path) %> <%= sort_tag('变化情况', name: 'percentage', path: school_data_contrast_managements_path) %>
<br> 新 增 数 | 新增百分比) <br> 新 增 数 | 新增百分比)

@ -1,12 +1,7 @@
<div style="background-color: #fafafa;"> <div style="background-color: #fafafa;">
统计总计: 统计总计:
<% if params[:grow_begin_date].present? %> <% if params[:grow_begin_date].present? %>
<% if params[:grow_begin_date] == params[:grow_end_date] %>
<%= Time.zone.parse(params[:grow_begin_date]).beginning_of_day.strftime('%Y-%m-%d') %> 05:00至
<%= (Time.zone.parse(params[:grow_begin_date]).beginning_of_day + 1.days).strftime('%Y-%m-%d') %> 05:00
<% else %>
<%= params[:grow_begin_date] %> 05:00至<%= (Time.zone.parse(params[:grow_end_date]) + 1.days).strftime('%Y-%m-%d') %> 05:00 <%= params[:grow_begin_date] %> 05:00至<%= (Time.zone.parse(params[:grow_end_date]) + 1.days).strftime('%Y-%m-%d') %> 05:00
<% end %>
<% else %> <% else %>
<%= (Time.current - 5.hour).beginning_of_day.ago(1.days).strftime('%Y-%m-%d') %> 05:00至 <%= (Time.current - 5.hour).beginning_of_day.ago(1.days).strftime('%Y-%m-%d') %> 05:00至
<%= (Time.current - 5.hour).beginning_of_day.strftime('%Y-%m-%d') %> 05:00 <%= (Time.current - 5.hour).beginning_of_day.strftime('%Y-%m-%d') %> 05:00

Loading…
Cancel
Save