Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-11-09 16:13:48 +0300
committerSean McGivern <sean@gitlab.com>2017-11-09 16:13:48 +0300
commitacf49c6d89a38806fd722c2b9052f99c68822e43 (patch)
treeed001d07ed570d362007dc88c44dce38856599ec /app/controllers
parent760b2c75ef9d2c6acb655860dceae4c04cd8e5a7 (diff)
Fix access to the final page of todos
The todos page limit is 20, and both that and a user's pending todo count are integers. Using integer division means that the result's floor will be taken, defeating the point of the later call to `#ceil`. So we need to convert one side of the division to a float first, otherwise the last page won't be treated as available.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/dashboard/todos_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb
index 02c5857eea7..e89eaf7edda 100644
--- a/app/controllers/dashboard/todos_controller.rb
+++ b/app/controllers/dashboard/todos_controller.rb
@@ -76,7 +76,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
def redirect_out_of_range(todos)
total_pages =
if todo_params.except(:sort, :page).empty?
- (current_user.todos_pending_count / todos.limit_value).ceil
+ (current_user.todos_pending_count.to_f / todos.limit_value).ceil
else
todos.total_pages
end