HomePhabricator

Disperse task subpriorities in blocks

Description

Disperse task subpriorities in blocks

Summary:
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!

Also:

  • 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