Fix toggling of completion.
authorJan Schneider <jan@horde.org>
Mon, 16 Nov 2009 15:15:46 +0000 (16:15 +0100)
committerJan Schneider <jan@horde.org>
Mon, 16 Nov 2009 15:15:46 +0000 (16:15 +0100)
kronolith/js/kronolith.js

index 0ad8dc0..c98f84c 100644 (file)
@@ -1686,7 +1686,10 @@ KronolithCore = {
     {
         // Update the cache.
         var task = this.tcache.inject(null, function(acc, list) {
-            if (!acc && !Object.isUndefined(list.value.get(tasklist))) {
+            if (acc) {
+                return acc;
+            }
+            if (!Object.isUndefined(list.value.get(tasklist))) {
                 return list.value.get(tasklist).get(taskid);
             }
         });
@@ -1697,6 +1700,9 @@ KronolithCore = {
         }
         task.cp = !task.cp;
 
+        this.tcache.get(task.cp ? 'complete' : 'incomplete').get(tasklist).set(taskid, task);
+        this.tcache.get(task.cp ? 'incomplete' : 'complete').get(tasklist).unset(taskid);
+
         // Remove row if necessary.
         var row = this._getTaskRow(taskid);
         if (!row) {