Cache poll participants

It looks like generating the poll takes sometime due to that method.
This commit is contained in:
Javi Martín
2019-03-19 20:06:21 +01:00
parent 6b0b9db969
commit 875cfac406

View File

@@ -104,7 +104,7 @@ class Poll::Stats
end
stats_cache(*stats_methods)
stats_cache :voters, :recounts
stats_cache :participants, :voters, :recounts
def stats_cache(key, &block)
Rails.cache.fetch("polls_stats/#{poll.id}/#{key}/v12", &block)