mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Opps this broke polls.
This commit is contained in:
parent
6538363c18
commit
f9ef1e1997
1 changed files with 4 additions and 3 deletions
|
@ -66,10 +66,11 @@ after_initialize do
|
|||
poll["voters"] = poll["anonymous_voters"] || 0
|
||||
all_options = Hash.new(0)
|
||||
|
||||
polls["#{user_id}"] ||= {}
|
||||
polls["#{user_id}"][poll_name] = options
|
||||
post.custom_fields[DiscoursePoll::VOTES_CUSTOM_FIELD] ||= {}
|
||||
post.custom_fields[DiscoursePoll::VOTES_CUSTOM_FIELD]["#{user_id}"] ||= {}
|
||||
post.custom_fields[DiscoursePoll::VOTES_CUSTOM_FIELD]["#{user_id}"][poll_name] = options
|
||||
|
||||
polls.each do |_, user_votes|
|
||||
post.custom_fields[DiscoursePoll::VOTES_CUSTOM_FIELD].each do |_, user_votes|
|
||||
next unless votes = user_votes[poll_name]
|
||||
votes.each { |option| all_options[option] += 1 }
|
||||
poll["voters"] += 1 if (available_options & votes.to_set).size > 0
|
||||
|
|
Loading…
Reference in a new issue