Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination not showing in Post#index #42

Closed
1v opened this issue Apr 3, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@1v
Copy link
Contributor

commented Apr 3, 2016

I have 30 posts in DB and for my main /post page pagination is not showing. I assume, because of Post.fast_count(tags) return 0

    begin
      count = Post.fast_count(tags)
    rescue => x
      respond_to_error("Error: #{x}", :action => "error")
      return
    end

So I changed it to just count = Post.count and it works.

@1v

This comment has been minimized.

Copy link
Contributor Author

commented Apr 23, 2016

Ended up with this:

    begin
      if tags
        count = Post.fast_count(tags)
      else
        count = Post.count
      end
    rescue => x
@1v

This comment has been minimized.

Copy link
Contributor Author

commented Apr 25, 2016

This cache is not updating:

      cache_version = Moebooru::CacheHelper.get_version
      key = { :post_count => tags, :v => cache_version }

      count = Rails.cache.fetch(key) do
        Post.count_by_sql(Post.generate_sql(tags, :count => true))
      end.to_i

github.com

cache_version always 0

Moebooru::CacheHelper.get_version:

    def get_version(type = "post")
      Rails.cache.read("#{type}_version").to_i
    end

github.com

@antonizoon

This comment has been minimized.

Copy link

commented Nov 24, 2016

I figured out that removing the .to_i restores the total and the pagination in post#index again!

Moebooru::CacheHelper.get_version:

    def get_version(type = "post")
      Rails.cache.read("#{type}_version")
    end

However, the per page gallery tag list on the left column on /post#index still doesn't show up. But pagination was the most important feature for me.

@nanaya

This comment has been minimized.

Copy link
Contributor

commented Nov 24, 2016

The default cache store (file_store) behaves slightly differently. Should be fixed now.

As for tag list on the left, default view only shows last one day uploaded posts' non-general tags. And cached for one hour.

@nanaya

This comment has been minimized.

Copy link
Contributor

commented Jul 18, 2018

Fixed, I guess?

@nanaya nanaya closed this Jul 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.