• epriestley's avatar
    Disperse task subpriorities in blocks · 1644b450
    epriestley authored
    Ref T7664. The current algorithm for moving task subpriorities can end up stuck in a real sticky swamp in some unusual situations.
    Instead, use an algorithm which works like this:
      - When we notice two tasks are too close together, look at the area around those tasks (just a few paces).
      - If things look pretty empty, we can just spread the tasks out a little bit.
      - But, if things are still real crowded, take another look further.
      - Keep doing that until we're looking at a real nice big spot which doesn't have too many tasks in it in total, even if they're all in one place right now.
      - Then, move 'em out!
      - Just swallow our pride and do the gross `INSERT INTO ... "", "", "", "", "", "", ... ON DUPLICATE KEY UPDATE` to bulk update.
      - Fix an issue where a single move could cause two different subpriority recalculations.
    Test Plan:
      - Changed `ManiphesTaskTestCase->testTaskAdjacentBlocks()` to insert 1,000 tasks with identical subpriorities, saw them spread out in 11 queries instead of >1,000.
      - Dragged tons of tasks around on workboards.
      - Ran unit tests.
    Reviewers: chad
    Reviewed By: chad
    Maniphest Tasks: T7664
    Differential Revision: https://secure.phabricator.com/D17959
ManiphestTransactionEditor.php 30.5 KB