Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert the tasks in a custom point #23

Open
5 tasks
just-hms opened this issue Jun 26, 2023 · 0 comments
Open
5 tasks

Insert the tasks in a custom point #23

just-hms opened this issue Jun 26, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@just-hms
Copy link
Contributor

just-hms commented Jun 26, 2023

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
@just-hms just-hms added the enhancement New feature or request label Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant