Save task ordering in DB
smaspe opened this issue · comments
smaspe commented
Use a string index to sort the tasks by alphabetical order
When inserting a task:
- Use the largest of the newly surrounding indices - 1 as new index value. (or the smallest + 1 if there is only a smaller one)
- If the surrounding tasks are immediately following each other (e.g.
'abdgh'
and'abdgi'
), use the n-1 and insert an extra letter. - If the index ends with
'a'
, insert'am'
instead - Never let an index end with
'a'
(so to keep room above) (there is nothing between'b'
and'ba'
, so use'bam'
instead)
Sort by reverse alphabetical order to easily make room for new tasks at the top