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:
Diffstat (limited to 'app/finders/error_tracking/errors_finder.rb')
-rw-r--r--app/finders/error_tracking/errors_finder.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/finders/error_tracking/errors_finder.rb b/app/finders/error_tracking/errors_finder.rb
index fb2d4b14dfa..d83a0c487e6 100644
--- a/app/finders/error_tracking/errors_finder.rb
+++ b/app/finders/error_tracking/errors_finder.rb
@@ -13,9 +13,10 @@ module ErrorTracking
collection = project.error_tracking_errors
collection = by_status(collection)
+ collection = sort(collection)
- # Limit collection until pagination implemented
- collection.limit(20)
+ # Limit collection until pagination implemented.
+ limit(collection)
end
private
@@ -33,5 +34,14 @@ module ErrorTracking
def authorized?
Ability.allowed?(current_user, :read_sentry_issue, project)
end
+
+ def sort(collection)
+ params[:sort] ? collection.sort_by_attribute(params[:sort]) : collection.order_id_desc
+ end
+
+ def limit(collection)
+ # Restrict the maximum limit at 100 records.
+ collection.limit([(params[:limit] || 20).to_i, 100].min)
+ end
end
end