gitlab-org--gitlab-foss/app/models/concerns
Sean McGivern d7a5a28c53 Fix pagination on sorts with lots of ties
Postgres and MySQL don't guarantee that pagination with `LIMIT` and
`OFFSET` will work if the ordering isn't unique. From the Postgres docs:

> When using `LIMIT`, it is important to use an `ORDER BY` clause that
> constrains the result rows into a unique order. Otherwise you will get
> an unpredictable subset of the query's rows

Before:

    [1] pry(main)> issues = 1.upto(Issue.count).map { |i| Issue.sort('priority').page(i).per(1).map(&:id) }.flatten
    [2] pry(main)> issues.count
    => 81
    [3] pry(main)> issues.uniq.count
    => 42

After:

    [1] pry(main)> issues = 1.upto(Issue.count).map { |i| Issue.sort('priority').page(i).per(1).map(&:id) }.flatten
    [2] pry(main)> issues.count
    => 81
    [3] pry(main)> issues.uniq.count
    => 81
2016-06-23 15:26:50 +01:00
..
access_requestable.rb
awardable.rb
case_sensitivity.rb
importable.rb
internal_id.rb
issuable.rb Fix pagination on sorts with lots of ties 2016-06-23 15:26:50 +01:00
mentionable.rb
milestoneish.rb
participable.rb Cache Participable#participants in instance variable 2016-06-21 12:54:12 +02:00
referable.rb Fix RangeError exceptions when referring to issues or merge requests outside of max database values 2016-06-18 13:07:38 -07:00
sortable.rb
statuseable.rb
strip_attribute.rb
subscribable.rb
taskable.rb
token_authenticatable.rb