How do I store orders?

后端 未结 6 697
太阳男子
太阳男子 2020-12-08 03:23

I have an app which has tasks in it and you can reorder them. Now I was woundering how to best store them. Should I have a colomn for the ordernumber and recalculate all of

6条回答
  •  一生所求
    2020-12-08 04:09

    Out of your answers I came up with a mixture which goes as follows:

    Say we have:

    • 1Example (1)
    • 2Example (2)
    • 3Example (3)
    • 4Example (4)
    • 5Example (5)

    Now if I sort something between 4 and 5 it would look like this:

    • 2Example (2)
    • 3Example (3)
    • 4Example (4)
    • 1Example (4.5)
    • 5Example (5)

    now again something between 1 and 5

    • 3Example (3)
    • 4Example (4)
    • 1Example (4.5)
    • 2Example (4.75)
    • 5Example (5)

    it will always take the half of the difference between the numbers

    I hope that works please do correct me ;)

提交回复
热议问题