Use stats objects instead of hashes

It will make it far easier to call other methods on the stats object,
and we're already caching the methods.

We had to remove the view fragment caching because the stats object
isn't as easy to cache. The good thing about it is the view will
automatically be updated when we change logic regarding which stats to
show, and the methods taking long to execute are cached in the model.
This commit is contained in:
Javi Martín
2019-03-18 15:38:53 +01:00
parent eba30d1585
commit 76c7827cf4
9 changed files with 244 additions and 290 deletions

View File

@@ -33,7 +33,7 @@ class PollsController < ApplicationController
end
def stats
@stats = Poll::Stats.new(@poll).generate
@stats = Poll::Stats.new(@poll)
end
def results