refactor upload tags report

This commit is contained in:
r888888888
2017-02-28 15:34:40 -08:00
parent 458a9692d6
commit 7f22baa1bc
4 changed files with 8 additions and 3 deletions

View File

@@ -18,4 +18,10 @@ class ReportsController < ApplicationController
def post_versions_create
@report = Reports::PostVersions.new(params[:tag], params[:type])
end
def upload_tags
@user = User.find(params[:user_id])
@upload_reports = Reports::UploadTags.for_user(params[:user_id]).order("id desc").paginate(params[:page], :limit => params[:limit])
respond_with(@upload_reports)
end
end

View File

@@ -29,7 +29,7 @@ class UploadTagsReport < Post
def uploader_tags_array
@uploader_tags ||= begin
added_tags = []
PostVersion.where(post_id: id, updater_id: uploader_id).each do |version|
PostArchive.where(post_id: id, updater_id: uploader_id).each do |version|
added_tags += version.changes[:added_tags]
end
added_tags.uniq.sort