Skip to content

Insert the tasks in a custom point #23

@just-hms

Description

@just-hms

Solution 1

  • edit the Position field to be a int
  • when adding a new task in a position x increment by 1 the position of every taks which has a position greater or equal then thei
    UPDATE tasks SET position = position+1 WHERE posizione>=x;

Solution 2

  • edit the Position field to be a string

  • still order by it

  • when a new task is added at position x do the following:

    • it's position is task[x+1].Position - task[x].Position
    • if they are there is no character between them use another character

    ex:

    |---------------|---------------|
    | name          | position      |
    |---------------|---------------|     +---- inserting here will give "BM"  
    | kek           | "B"           |     |
    |---------------|---------------| <---+    
    | ciao          | "C"           |
    |---------------|---------------|
    ...
    |---------------|---------------|     +---- inserting here will give "DT"
    | miao          | "DM"          |     |
    |---------------|---------------| <---+
    | miao          | "F"           |
    |---------------|---------------|
    
    

    ⚠️ Attention:

    • in this example the alphabet is used for simplicity but one can use the 0x00000 as min and 0xFFFFF as max
    • the max and min value are off limits to leave space for appending to the head and tail

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions