This commit is contained in:
Vokhmin Alexey V 2014-10-22 01:19:50 +04:00
parent f39c9e0bb5
commit fac4f5638b
2 changed files with 5 additions and 3 deletions

View File

@ -61,9 +61,11 @@ class Statistic < ActiveRecord::Base
FROM relations
INNER JOIN projects ON projects.id = relations.target_id
WHERE relations.target_type = 'Project' AND
relations.actor_type = 'Group' AND relations.actor_id IN (:groups)
projects.owner_type = 'Group' AND
relations.actor_type = 'Group' AND
relations.actor_id IN (:groups)
)
)", { user: @user, groups: group_ids }
)", { groups: group_ids }
]) if group_ids.present?
}

View File

@ -52,7 +52,7 @@ class StatisticPresenter < ApplicationPresenter
end
def group_ids
@group_ids ||= Group.where(uname: users_or_groups).map(&:member_ids).flatten.uniq
@group_ids ||= Group.where(uname: users_or_groups).pluck(:id)
end
def scope