Created
July 5, 2017 15:06
-
-
Save gdeer81/b9d69b8c6915cd7f9199a9fa3359e145 to your computer and use it in GitHub Desktop.
This set of rules causes all products to be hidden...but why?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Filtering | |
; product visible when no filter | |
(define [:app :visible-product/id ?e] :- [:not [_ :product-filter/range]] | |
[:not [_ :product-filter/category]] | |
[[?e :product/name]]) | |
; product visible when filter active and price in range | |
(define [:app :visible-product/id ?e] | |
:- [[_ :product-filter/range ?range]] | |
[[?e :product/price ?price]] | |
[:test (<= (first ?range) ?price (second ?range))]) | |
; product visible when filter active and product category = selected category | |
(define [:app :visible-product/id ?e] | |
:- [[_ :product-filter/category ?selected-category]] | |
[[?e :product/category ?category]] | |
[:test (= ?category ?selected-category)]) |
This had nothing to do with the rules. the subscriptions get broken when there is a clojursecript error
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Minor note you should be able to write the third rule as the following instead of using
:test
: