def self.alternatives_for_test(test_name)
cache_key = "Abingo::#{test_name}::alternatives".gsub(" ","_")
Abingo.cache.fetch(cache_key) do
experiment = ABingoCampingPlugin::Models::Experiment.find_by_test_name(test_name)
alternatives_array = Abingo.cache.fetch(cache_key) do
tmp_array = experiment.alternatives.map do |alt|
[alt.content, alt.weight]
end
tmp_hash = tmp_array.inject({}) {|hash, couplet| hash[couplet[0]] = couplet[1]; hash}
Abingo.parse_alternatives(tmp_hash)
end
alternatives_array
end
end