Fetch post counts instead of relying on the estimate

This commit is contained in:
Kira 2020-01-23 08:53:56 -08:00
parent 1e56b9302b
commit e50094f588
3 changed files with 12 additions and 2 deletions

View File

@ -67,6 +67,9 @@ end
group :development do
gem 'sinatra'
gem 'rack-mini-profiler'
gem 'flamegraph'
gem 'stackprof'
end
group :development, :test do

View File

@ -157,6 +157,7 @@ GEM
ffi (1.11.3-x64-mingw32)
ffi-win32-extensions (1.0.3)
ffi
flamegraph (0.9.5)
get_process_mem (0.2.5)
ffi (~> 1.0)
globalid (0.4.2)
@ -266,6 +267,8 @@ GEM
win32-file (>= 0.7.0)
public_suffix (4.0.2)
rack (2.0.8)
rack-mini-profiler (1.1.4)
rack (>= 1.2.0)
rack-protection (2.0.8.1)
rack
rack-proxy (0.6.5)
@ -368,6 +371,7 @@ GEM
sshkit (1.20.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stackprof (0.2.15)
statistics2 (0.54)
streamio-ffmpeg (3.0.2)
multi_json (~> 1.8)
@ -446,6 +450,7 @@ DEPENDENCIES
elasticsearch-rails
factory_bot
ffaker
flamegraph
httparty
jquery-rails
listen
@ -461,6 +466,7 @@ DEPENDENCIES
pg
pry-byebug
ptools
rack-mini-profiler
radix62 (~> 1.0.1)
rails (~> 6.0)
rakismet
@ -480,6 +486,7 @@ DEPENDENCIES
simple_form
simplecov
sinatra
stackprof
statistics2
streamio-ffmpeg
timecop

View File

@ -126,9 +126,9 @@ module PostSets
def posts
@posts ||= begin
if raw
temp = ::Post.raw_tag_match(tag_string).paginate(page, count: post_count, :limit => per_page, includes: [:uploader])
temp = ::Post.raw_tag_match(tag_string).paginate(page, count: get_post_count, limit: per_page, includes: [:uploader])
else
temp = ::Post.tag_match(tag_string).paginate(page, count: post_count, :limit => per_page, includes: [:uploader])
temp = ::Post.tag_match(tag_string).paginate(page, count: get_post_count, limit: per_page, includes: [:uploader])
end
@post_count = temp.total_count