Alanaktion / phproject

A high performance full-featured project management system
https://www.phproject.org
GNU General Public License v3.0
388 stars 106 forks source link

Store backlog items as individual rows with sort orders #280

Open Alanaktion opened 7 years ago

Alanaktion commented 7 years ago

This allows us to save backlog sort orders on an individual level, which helps prevent conflicts from multiple users updating the backlog at the same time. This could be implemented by running an UPDATE ... WHERE sort > ? query, moving any items below the new item's position down by 1.

Alanaktion commented 6 years ago

An implementation of this is working on the v1.7-new-backlog branch, but has negative side effects where sort indexes can get incorrectly adjusted.

To reproduce this invalid behavior:

  1. Have a sprint with a few projects in it
  2. Add a project to a sprint by editing, rather than through the backlog
  3. Move an item to the bottom of the sprint on the backlog page
  4. Reload the page -- the item not added via the backlog will still show below the item that was moved to the bottom

This could be fixed by doing something like checking that all items in the sprint/backlog have issue_backlog entries every time an item is updated. A performant way to do that would be sending an array of items without an index with each AJAX call to the update endpoint, and using a bulk insert query to add them. It would also be necessary to support splitting that array if the moved item triggering the AJAX call was dropped in the middle of the unindexed items.