diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-12-17 15:50:36 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-12-17 15:55:17 +0000 |
commit | 06887f4ebad15b8feee8864208a03bb85f328fac (patch) | |
tree | 949de1f34e625ae32e57e98df2079b2329d5f369 | |
parent | de20a797f247df93177e2754420d8478866a64b3 (diff) |
Limit pagination on similar pages in line with new upper limit on page offset.
-rw-r--r-- | app/controllers/request_controller.rb | 2 | ||||
-rw-r--r-- | app/views/request/similar.rhtml | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 5d950ceb2..970dfca45 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -153,6 +153,8 @@ class RequestController < ApplicationController end @xapian_object = ::ActsAsXapian::Similar.new([InfoRequestEvent], @info_request.info_request_events, :offset => (@page - 1) * @per_page, :limit => @per_page, :collapse_by_prefix => 'request_collapse') + @matches_estimated = @xapian_object.matches_estimated + @show_no_more_than = (@matches_estimated > MAX_RESULTS) ? MAX_RESULTS : @matches_estimated if (@page > 1) @page_desc = " (page " + @page.to_s + ")" diff --git a/app/views/request/similar.rhtml b/app/views/request/similar.rhtml index d9806aeb1..0d53f6919 100644 --- a/app/views/request/similar.rhtml +++ b/app/views/request/similar.rhtml @@ -20,4 +20,4 @@ <% end %> <% end %> -<%= will_paginate WillPaginate::Collection.new(@page, @per_page, @xapian_object.matches_estimated) %> +<%= will_paginate WillPaginate::Collection.new(@page, @per_page, @show_no_more_than) %> |