diff options
author | Tom Willemse | 2013-07-15 22:01:36 +0200 |
---|---|---|
committer | Tom Willemse | 2013-07-15 22:01:36 +0200 |
commit | cfab0475f33233a4d36d729e8cf6e34edd45d0aa (patch) | |
tree | 224cd7737079ac34502a41b1f09a2221e9ac8262 | |
parent | 86b448369e155b98c0659c3e360f62f70a1cca97 (diff) | |
download | scrumli-cfab0475f33233a4d36d729e8cf6e34edd45d0aa.tar.gz scrumli-cfab0475f33233a4d36d729e8cf6e34edd45d0aa.zip |
Keep priorities from diverging
Priorities should always be a sequence...
-rw-r--r-- | pg-datastore.lisp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pg-datastore.lisp b/pg-datastore.lisp index 805e748..260902e 100644 --- a/pg-datastore.lisp +++ b/pg-datastore.lisp @@ -94,8 +94,11 @@ :where (:= 'id id)) :single)) (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 :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)))))) |