I am working on a Django
web application where users create a list of tasks. Each task is a record in the database (ie: a Django object) and the user is able to assign each task a priority.
If the user creates 10 tasks, each of them would have a priority from 1 to 10. I'm struggling to figure out an efficient way to allow users to change the priority of tasks as well as insert and delete tasks. For example:
- A user moves task priority 3 down to 7. The other tasks priorities need to be adjusted accordingly.
- A user deletes task with priority 4. Once again the remaining tasks priorities would need to be adjusted.
- A user inserts a new task with priority 5. This means the existing tasks from priority 5 onwards need to be shifted.
Are there any design patterns or suggestions on how to manage what essentially amounts to a queue based on the priority of each item while allowing users to:
- Move tasks up and down the priority list
- Delete tasks
- Add new tasks with specified priorities.
Aucun commentaire:
Enregistrer un commentaire