mixonic/ranked-model — pull request #67 by jacobevans (2014-02-20 22:47:22+00:00)
Title: rebalance ranks when we try to position an item between two other items with identical ranks.

This handles the edge case of trying to position an item between two items that have the same rank as each other. This, obviously, shouldn't happen, but easily can.

For example, it is possible (actually, likely) in a production scenario when many items (that are part of a ranking) are created at the same time, across multiple server processes/threads. You'll end up with items with the same ranking.

This fix doesn't stop that from happening, but it ensures that there is eventually consistent data when the items get re-ranked.

Without this, if you try to rank an item between two items with the same rank, nobody's ranking is changed (neither the item you're trying to rank, nor the neighbors).