<div class="box pb-4 pt-0 pl-0">
  统计总计：
  <% if params[:grow_begin_date].present? %>
    <%= params[:grow_begin_date] %> 05:00至<%= (Time.zone.parse(params[:grow_end_date]) + 1.days).strftime('%Y-%m-%d') %> 05:00
  <% else %>
    <%= (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，
  <% end %>
  新增教师<span class="text-danger"><%= @grow_summary.teacher_increase_count || 0 %></span>人，
  新增学生<span class="text-danger"><%= @grow_summary.student_increase_count || 0 %></span>人，
  新增课堂<span class="text-danger"><%= @grow_summary.course_increase_count || 0 %></span>个，
  新增实训<span class="text-danger"><%= @grow_summary.shixun_increase_count || 0 %></span>个，
  新增实训作业<span class="text-danger"><%= @grow_summary.shixun_homework_count || 0 %></span>个，
  新增实训评测<span class="text-danger"><%= @grow_summary.shixun_evaluate_count || 0 %></span>个，
  活跃用户<span class="text-danger">
  <%= @grow_summary.uniq_active_user_count.to_i.zero? ? @grow_summary.active_user_count.to_i : @grow_summary.uniq_active_user_count.to_i %>
  </span>个
</div>

<table class="table table-hover text-center daily-school-statistic-list-table">
  <thead class="thead-light">
  <tr>
    <th width="24%" class="text-left">单位名称</th>
    <th width="12%"><%= sort_tag('新增教师', name: 'teacher_increase_count', path: admins_school_statistics_path) %></th>
    <th width="12%"><%= sort_tag('新增学生', name: 'student_increase_count', path: admins_school_statistics_path) %></th>
    <th width="12%"><%= sort_tag('新增课堂', name: 'course_increase_count', path: admins_school_statistics_path) %></th>
    <th width="12%"><%= sort_tag('新增实训', name: 'shixun_increase_count', path: admins_school_statistics_path) %></th>
    <th width="12%"><%= sort_tag('新增实训作业', name: 'shixun_homework_count', path: admins_school_statistics_path) %></th>
    <th width="12%"><%= sort_tag('新增实训评测', name: 'shixun_evaluate_count', path: admins_school_statistics_path) %></th>
    <th width="12%"><%= sort_tag('活跃用户', name: 'uniq_active_user_count', path: admins_school_statistics_path) %></th>
  </tr>
  </thead>
  <tbody>
  <% if statistics.present? %>
    <% statistics.each do |statistic| %>
      <tr>
        <td class="text-left">
          <%= link_to statistic.school_name, "/colleges/#{statistic.school_id}/statistics",
                      target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %>
        </td>
        <td><%= statistic.teacher_increase_count.to_i %></td>
        <td><%= statistic.student_increase_count.to_i %></td>
        <td><%= statistic.course_increase_count.to_i %></td>
        <td><%= statistic.shixun_increase_count.to_i %></td>
        <td><%= statistic.shixun_homework_count.to_i %></td>
        <td><%= statistic.shixun_evaluate_count.to_i %></td>
        <td><%= statistic.uniq_active_user_count.to_i.zero? ? statistic.active_user_count.to_i : statistic.uniq_active_user_count.to_i %></td>
      </tr>
    <% end %>
  <% else %>
    <%= render 'admins/shared/no_data_for_table' %>
  <% end %>
  </tbody>
</table>

<%= render partial: 'admins/shared/paginate', locals: { objects: statistics } %>