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