数据的过滤

This commit is contained in:
cxt 2018-05-09 09:49:00 +08:00
parent 232c556fa8
commit d3f2b616c1
3 changed files with 7 additions and 7 deletions

View File

@ -24,7 +24,8 @@ class StatisticsController < ApplicationController
@statistics = Statistic.find_by_sql("SELECT statistics.* from statistics order by #{type} #{order}")
end
end
@statistics_count = @statistics.count
@statistics_count = @statistics.size
Rails.logger.info("statistics_count-------------#{@statistics_count}");
@data_size = data_format_string @statistics.select{|c| !c.file_size.nil?}.map{|s| s.file_size}.sum
@limit = 10
@is_remote = true
@ -34,7 +35,6 @@ class StatisticsController < ApplicationController
respond_to do |format|
format.js
format.html # index.html.erb
format.json { render json: @statistics }
end
end

View File

@ -49,7 +49,7 @@
<script>
function get_sub_categories(id){
$.ajax({
url: "<%= get_sub_category_statistics_path(:come_from => "statistics_index") %>",
url: "<%= statistics_path(:come_from => "statistics_index") %>",
data: {main_category_id: id},
dataType: "script"
})

View File

@ -1,6 +1,6 @@
<% if params[:come_from] == "statistics_index" %>
$("#sub_categories_list").html('<%= j(render :partial => "sub_categories_list") %>');
$("#sub_categories_list").html("<%= j(render :partial => 'sub_categories_list') %>");
<% end %>
$("#search_count").html(<%= @statistics_count %>);
$("#data_size").html(<%= @data_size %>);
$("#statistics_list").html("<%= j(render :partial => "statistics_list") %>");
$("#search_count").html("<%= @statistics_count %>");
$("#data_size").html("<%= @data_size %>");
$("#statistics_list").html("<%= j(render :partial => 'statistics_list') %>");