diff --git a/app/models/community.rb b/app/models/community.rb index c9dd0ddfb..fb3e5dc7c 100644 --- a/app/models/community.rb +++ b/app/models/community.rb @@ -6,6 +6,7 @@ class Community < ActiveRecord::Base def participants users_participants = users_who_commented + users_who_topics_author + + response_author_from_polls_for_proposal + author_from_community users_participants.uniq end @@ -31,4 +32,13 @@ class Community < ActiveRecord::Base from_proposal? ? User.where(id: proposal&.author_id) : User.where(id: investment&.author_id) end + def response_author_from_polls_for_proposal + author_ids = [] + + Poll.where(related: proposal).each do |poll| + author_ids += poll.questions.pluck(:author_id) + end + + User.by_authors(author_ids.uniq) + end end