add Poll#associated_shards

This commit adds the Poll#associated_shards method so that
with_each_shard acts sane.

Test plan
- The poll_choices index endpoint should work correctly

Change-Id: Iabb0f3db25aec7e60ec1013424b534fa2c08102a
Reviewed-on: https://gerrit.instructure.com/36068
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
This commit is contained in:
Josh Simpson 2014-06-07 18:05:55 -06:00 committed by Derek DeVries
parent 66ab0c0b9b
commit f20f1631ee
1 changed files with 4 additions and 0 deletions

View File

@ -63,6 +63,10 @@ module Polling
results.any? results.any?
end end
def associated_shards
user.associated_shards
end
def total_results def total_results
poll_sessions.reduce(Hash.new(0)) do |poll_results, session| poll_sessions.reduce(Hash.new(0)) do |poll_results, session|
poll_results = poll_results.merge(session.results) do |key, poll_result_value, session_result_value| poll_results = poll_results.merge(session.results) do |key, poll_result_value, session_result_value|