[isidorus-cvs] r719 - trunk/src/rest_interface

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Wed Aug 10 19:45:21 UTC 2011


Author: lgiessmann
Date: Wed Aug 10 12:45:20 2011
New Revision: 719

Log:
trunk: rest-interface: fixed updated-fragments, that is invoked after a delete-operation. Now, it can handle multiple fragments that belongs to one topic

Modified:
   trunk/src/rest_interface/set-up-json-interface.lisp

Modified: trunk/src/rest_interface/set-up-json-interface.lisp
==============================================================================
--- trunk/src/rest_interface/set-up-json-interface.lisp	Wed Aug 10 07:55:51 2011	(r718)
+++ trunk/src/rest_interface/set-up-json-interface.lisp	Wed Aug 10 12:45:20 2011	(r719)
@@ -684,13 +684,20 @@
 			 (loop for role in (roles inst :revision rev)
 			    collect (d:player role :revision rev)))))))
 	 (fragments
-	  (delete-if #'null
-		     (map 'list (lambda(top)
-				  (elephant:get-instance-by-value
-				   'd:FragmentC 'd::topic top))
-			  (delete-duplicates
-			   (delete deleted-topic
-				   (delete-if #'null all-tops)))))))
+	  (delete-if
+	   #'null
+	   (map 'list (lambda(top)
+			(let ((all-frgs
+			       (sort 
+				(elephant:get-instances-by-value
+				 'd:FragmentC 'd::topic top)
+				#'> :key 'revision)))
+			  (let ((frg (first all-frgs)))
+			    (map nil 'elephant:drop-instance (rest all-frgs))
+			    frg)))
+		(delete-duplicates
+		 (delete deleted-topic
+			 (delete-if #'null all-tops)))))))
     (map nil (lambda(frg)
 	       (setf (slot-value frg 'd::serializer-cache) nil)
 	       (d:serialize-fragment frg (fragment-serializer)))




More information about the Isidorus-cvs mailing list