[isidorus-cvs] r174 - in trunk/src: model unit_tests
Lukas Giessmann
lgiessmann at common-lisp.net
Mon Jan 18 09:56:44 UTC 2010
Author: lgiessmann
Date: Mon Jan 18 04:56:43 2010
New Revision: 174
Log:
fixed a problem in the function \"get-most-recent-version-info\" -> ticket #62
Modified:
trunk/src/model/datamodel.lisp
trunk/src/unit_tests/versions_test.lisp
Modified: trunk/src/model/datamodel.lisp
==============================================================================
--- trunk/src/model/datamodel.lisp (original)
+++ trunk/src/model/datamodel.lisp Mon Jan 18 04:56:43 2010
@@ -422,7 +422,14 @@
new-construct))))
(defmethod get-most-recent-version-info ((construct TopicMapConstructC))
- (find 0 (versions construct) :key #'end-revision))
+ (let ((result (find 0 (versions construct) :key #'end-revision)))
+ (if result
+ result ;current version-info -> end-revision = 0
+ (let ((sorted-list (sort (versions construct)
+ #'(lambda(x y)
+ (> (end-revision x) (end-revision y))))))
+ (when sorted-list
+ (first sorted-list)))))) ;latest version-info of marked-as-deleted constructs -> highest integer
(defgeneric equivalent-constructs (construct1 construct2)
(:documentation "checks if two topic map constructs are equal according to the TMDM equality rules"))
Modified: trunk/src/unit_tests/versions_test.lisp
==============================================================================
--- trunk/src/unit_tests/versions_test.lisp (original)
+++ trunk/src/unit_tests/versions_test.lisp Mon Jan 18 04:56:43 2010
@@ -360,7 +360,10 @@
(mark-as-deleted semantic-standard-topic :source-locator "http://blablub.egovpt.org/"
:revision fixtures::revision3)
(is-true (get-item-by-psi "http://psi.egovpt.org/types/semanticstandard"
- :revision (1+ fixtures::revision3))))))
+ :revision (1+ fixtures::revision3)))
+ (is (= 0 (d::end-revision (d::get-most-recent-version-info semantic-standard-topic))))
+ (is (= (d::end-revision (first (last (d::versions norwegian-curriculum-topic))))
+ (d::end-revision (d::get-most-recent-version-info norwegian-curriculum-topic)))))))
More information about the Isidorus-cvs
mailing list