修改用户关注列表的总数问题

This commit is contained in:
sylor_huang@126.com 2020-05-18 12:06:00 +08:00
parent 4b3f45bcce
commit d75b9dd04c
5 changed files with 7 additions and 4 deletions

View File

@ -84,16 +84,19 @@ class ProjectsController < ApplicationController
def watch_users
watchers = @project.watchers.includes(:user).order("watchers.created_at asc").distinct
@watchers_count = watchers.size
@watchers = paginate(watchers)
end
def praise_users
praises = @project.praise_treads.includes(:user).order("praise_treads.created_at asc").distinct
@praises_count = praises.size
@praises = paginate(praises)
end
def fork_users
fork_users = @project.fork_users.includes(:user, :project).order("fork_users.created_at asc").distinct
@forks_count = fork_users.size
@fork_users = paginate(fork_users)
end

View File

@ -1,4 +1,4 @@
json.count @fork_users.size
json.count @forks_count
json.fork_users do
json.array! @fork_users.each do |f|
user = f.user

View File

@ -1,4 +1,4 @@
json.count @praises.size
json.count @praises_count
json.praises do
json.partial! "/projects/list_user", collection: @praises, as: :target
end

View File

@ -1,4 +1,4 @@
json.cout @watchers.size
json.cout @watchers_count
json.watchers do
json.partial! "/projects/list_user", collection: @watchers, as: :target
end

View File

@ -1,4 +1,4 @@
json.total_count @watchers.size
json.total_count @scopes_size
json.watchers do
json.partial! 'watcher', collection: @watchers, as: :watcher
end