Keep priorities from diverging
Priorities should always be a sequence...
This commit is contained in:
parent
86b448369e
commit
cfab0475f3
1 changed files with 5 additions and 2 deletions
|
@ -94,8 +94,11 @@
|
||||||
:where (:= 'id id))
|
:where (:= 'id id))
|
||||||
:single))
|
:single))
|
||||||
(next-priority (funcall (ecase dir (:up #'-) (:down #'+))
|
(next-priority (funcall (ecase dir (:up #'-) (:down #'+))
|
||||||
current-priority 1)))
|
current-priority 1))
|
||||||
|
(max-priority (query (:select (:max 'priority) :from type)
|
||||||
|
:single)))
|
||||||
(execute (:update type :set 'priority current-priority
|
(execute (:update type :set 'priority current-priority
|
||||||
:where (:= 'priority next-priority)))
|
:where (:= 'priority next-priority)))
|
||||||
(execute (:update type :set 'priority next-priority
|
(execute (:update type :set
|
||||||
|
'priority (max 1 (min next-priority max-priority))
|
||||||
:where (:= 'id id))))))
|
:where (:= 'id id))))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue