Proposal community

Poll participants become automatically members of the proposal community
This commit is contained in:
Juan Salvador Pérez García
2018-07-04 08:19:04 +02:00
parent f5e5c62242
commit 33d227d5dd

View File

@@ -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