mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-09 14:34:03 +08:00
init project
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<div style="position: relative;">
|
||||
<div style="padding: 15px 0; text-align: center; font-size: 18px; font-weight: bold; border: 1px solid #eee; border-bottom: unset;">
|
||||
学校数据统计(<%= I18n.t("school_daily_report.#{params[:contrast_column]}") %>变化统计情况)
|
||||
</div>
|
||||
<%= select_tag :contrast_column,
|
||||
options_for_select(select_options, params[:contrast_column]),
|
||||
class: 'form-control contrast-column-select' %>
|
||||
|
||||
<% if statistics.present? %>
|
||||
<div style="position: absolute; left: 20px; bottom: 0; font-size: 12px;">
|
||||
说明:新增数=时段二-时段一;新增百分比=(新增数/时段一)*100%(保留小数点后五位)
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if statistics.present? %>
|
||||
<table class="table table-hover text-center daily-school-statistic-list-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="36%" class="text-left">单位名称</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至#{(Time.zone.parse(params[:other_end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00)" %></th>
|
||||
<th width="20%" colspan="2">
|
||||
<%= sort_tag('变化情况', name: 'percentage', path: contrast_admins_school_statistics_path) %>
|
||||
<br>( 新 增 数 | 新增百分比)
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% 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['total'] %></td>
|
||||
<td><%= statistic['other_total'] %></td>
|
||||
<%
|
||||
increase = statistic['other_total'] - statistic['total']
|
||||
percentage = statistic['total'].zero? ? increase.to_f * 100 : (increase / statistic['total'].to_f) * 100
|
||||
%>
|
||||
<% if increase > 0 %>
|
||||
<td class="text-right pr-2 text-danger relative right-border">
|
||||
+<%= increase %>
|
||||
</td>
|
||||
<% if statistic['total'].zero? %>
|
||||
<td class="text-left pl-2">-</td>
|
||||
<% else %>
|
||||
<td class="text-left pl-2 text-danger">+<%= percentage.round(5) %>%</td>
|
||||
<% end %>
|
||||
<% elsif increase.zero? %>
|
||||
<td class="text-right pr-2 right-border relative" style="position: relative;">
|
||||
<%= increase %>
|
||||
</td>
|
||||
<td class="text-left pl-2"><%= percentage.round(5) %>%</td>
|
||||
<% else %>
|
||||
<td class="text-right pr-2 right-border relative text-success">
|
||||
<%= increase %>
|
||||
</td>
|
||||
<td class="text-left pl-2 text-success"><%= percentage.round(5) %>%</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: statistics } %>
|
||||
<% else %>
|
||||
<div style="padding-top: 150px; height: 250px; text-align: center; color: grey; font-size: 14px;">
|
||||
暂无数据,请选择时间段对比
|
||||
</div>
|
||||
<% end %>
|
||||
58
app/views/admins/school_statistics/shared/_list.html.erb
Normal file
58
app/views/admins/school_statistics/shared/_list.html.erb
Normal file
@@ -0,0 +1,58 @@
|
||||
<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="4%">序号</th>
|
||||
<th width="20%" 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_with_index do |statistic, index| %>
|
||||
<tr>
|
||||
<td><%= list_index_no(@params_page.to_i, index) %></td>
|
||||
<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 } %>
|
||||
Reference in New Issue
Block a user