Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn cat-and-subs [cat]
- (-> @(q/select categories
- (q/where (and (not (= :super nil))
- (= :super cat))))
- map-id
- (conj cat)))
- (defn items-by-cat [cat]
- (-> items
- (q/select (q/where (p/in :category
- (cat-and-subs cat))))))
- @(items-by-cat 1) ; category 1 is not a super of anything - works fine
- @(items-by-cat 3) ; 3 is the super of 5, this throws "The column index is out of range: 2, number of columns: 1."
- (cat-and-subs 3) ; returns (3 5)
- @(-> items
- (q/select (q/where (p/in :category [3 5])))) ; this works, and by substitution SHOULD be the same as (items-by-cat 3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement