selectByComponents
This commit is contained in:
@@ -181,4 +181,7 @@
|
|||||||
entries) // TODO this includes entries that didn't have the tag in the changeset
|
entries) // TODO this includes entries that didn't have the tag in the changeset
|
||||||
|
|
||||||
(defcommand selectByTags [tagsBoolExp (Text null)]
|
(defcommand selectByTags [tagsBoolExp (Text null)]
|
||||||
(selectEntries (filter archive.entries ->e (tagsMatch archive e tagsBoolExp)))))
|
(selectEntries (filter archive.entries ->e (tagsMatch archive e tagsBoolExp))))
|
||||||
|
|
||||||
|
(defcommand selectByComponents [componentsBoolExp (Text null)]
|
||||||
|
(selectEntries (filter archive.entries ->e (componentsMatch e componentsBoolExp)))))
|
||||||
@@ -71,3 +71,6 @@
|
|||||||
|
|
||||||
(defun tagsMatch [archive e tagsBoolExp]
|
(defun tagsMatch [archive e tagsBoolExp]
|
||||||
(BoolExpInterp.eval tagsBoolExp (tagList archive e)))
|
(BoolExpInterp.eval tagsBoolExp (tagList archive e)))
|
||||||
|
|
||||||
|
(defun componentsMatch [:nat.Entry e componentsBoolExp]
|
||||||
|
(BoolExpInterp.eval componentsBoolExp (for =>cType cId e.components cType)))
|
||||||
@@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
(assert (hasComponent song1 Tags))
|
(assert (hasComponent song1 Tags))
|
||||||
(assert (hasComponent song2 Tags))
|
(assert (hasComponent song2 Tags))
|
||||||
|
(assert (componentsMatch song1 "(and Name Author)"))
|
||||||
|
(assert (componentsMatch song2 "(and Name Author)"))
|
||||||
(assert (tagsMatch archive song1 "(and song western)"))
|
(assert (tagsMatch archive song1 "(and song western)"))
|
||||||
(assert !(tagsMatch archive song1 "(and song religious)"))
|
(assert !(tagsMatch archive song1 "(and song religious)"))
|
||||||
(assert (tagsMatch archive song2 "(and song religious)"))
|
(assert (tagsMatch archive song2 "(and song religious)"))
|
||||||
|
|||||||
Reference in New Issue
Block a user