fix library download count bug

dev_aliyun
p31729568 5 years ago
parent 254af9cfc1
commit 948537173f

@ -23,7 +23,7 @@ class LibrariesController < ApplicationController
per_page = params[:per_page].to_i <= 0 ? 20 : params[:per_page].to_i per_page = params[:per_page].to_i <= 0 ? 20 : params[:per_page].to_i
@libraries = paginateHelper libraries.includes(:library_tags, :praise_tread_cache, user: :user_extensions), per_page @libraries = paginateHelper libraries.includes(:library_tags, :praise_tread_cache, user: :user_extensions), per_page
@download_count_map = Attachment.where(container_type: 'Library', container_id: @libraries.map(&:id)).group(:container_id).count @download_count_map = Attachment.where(container_type: 'Library', container_id: @libraries.map(&:id)).group(:container_id).sum(:downloads)
end end
def show def show

Loading…
Cancel
Save