Commit 44e370a0e631a1740e1b8d19c56e35df32fdf918
1 parent
2c35c315
Exists in
master
and in
7 other branches
Revert "Disable cache on ranking"
This reverts commit 34e1b1bda56186e7f1632fe72f9679692d7f43a1.
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
lib/proposals_discussion_plugin/api.rb
... | ... | @@ -5,7 +5,7 @@ class ProposalsDiscussionPlugin::API < Grape::API |
5 | 5 | paginate per_page: 10, max_per_page: 20 |
6 | 6 | get ':id/ranking' do |
7 | 7 | article = find_article(environment.articles, params[:id]) |
8 | - #ranking = Rails.cache.fetch("#{article.cache_key}/proposals_ranking", expires_in: 30.minutes) do | |
8 | + ranking = Rails.cache.fetch("#{article.cache_key}/proposals_ranking", expires_in: 10.minutes) do | |
9 | 9 | max_hits = article.proposals.maximum(:hits) |
10 | 10 | min_hits = article.proposals.minimum(:hits) |
11 | 11 | |
... | ... | @@ -16,8 +16,8 @@ class ProposalsDiscussionPlugin::API < Grape::API |
16 | 16 | {:id => proposal.id, :abstract => proposal.abstract, :votes_for => proposal.votes_for, :votes_against => proposal.votes_against, :hits => proposal.hits, :effective_support => effective_support} |
17 | 17 | end |
18 | 18 | proposals = proposals.sort_by { |p| p[:effective_support] }.reverse |
19 | - ranking = {:proposals => proposals, :updated_at => DateTime.now} | |
20 | - #end | |
19 | + {:proposals => proposals, :updated_at => DateTime.now} | |
20 | + end | |
21 | 21 | ranking[:proposals] = paginate ranking[:proposals] |
22 | 22 | ranking |
23 | 23 | end | ... | ... |