Files
wekan/models/lib/scrumCardOrder.js
T
Lauri Ojansivu 9f3fbfd528 Keep Scrum planning order consistent for equal ranks
Use stable card IDs to break equal effective-rank ties across fetches and clients. Preserve explicit zero ranks and normal list-position fallback. Cover metadata edits and refreshes in Chromium.

Thanks to xet7 !
2026-09-27 20:36:08 +03:00

13 lines
445 B
JavaScript

'use strict';
// List positions can repeat across a board, and explicit backlog ranks need
// not be unique. A stable ID tie-breaker keeps refreshes and clients aligned.
function compareScrumCards(a, b) {
const rank = card => card.scrum?.backlogRank ?? card.sort ?? 0;
const difference = rank(a) - rank(b);
if (difference) return difference;
return a._id < b._id ? -1 : a._id > b._id ? 1 : 0;
}
module.exports = { compareScrumCards };