Last active
January 26, 2017 01:10
-
-
Save jdkealy/174741e33b88b09b66e6f0281e3cd6ca to your computer and use it in GitHub Desktop.
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
(defn cart-line-items [cid _db & [organization]] | |
(d/q '[:find ?e ?org ?name ?price ?dl_or_ph | |
:in $ ?cart | |
:where | |
[?e :line_item/cart ?cart] | |
[?cart :cart/subtotal ?subtotal] | |
[?e :line_item/content ?content] | |
[?e :line_item/dl_or_ph ?dl_or_ph] | |
[?e :line_item/price ?price] | |
[?content :content/collection ?coll] | |
[?coll :collection/organization ?org] | |
[?org :user/name ?name]] | |
_db cid)) | |
;organization is optional... end up writing this wtf query... | |
(defn cart-line-items [cid _db & [organization]] | |
(if organization | |
(d/q '[:find ?e ?org ?name ?price ?dl_or_ph | |
:in $ ?cart ?org | |
:where | |
[?e :line_item/cart ?cart] | |
[?e :line_item/content ?content] | |
[?e :line_item/dl_or_ph ?dl_or_ph] | |
[?e :line_item/price ?price] | |
[?content :content/collection ?coll] | |
[?coll :collection/organization ?org] | |
[?org :user/name ?name]] | |
_db cid organization) | |
(d/q '[:find ?e ?org ?name ?price ?dl_or_ph | |
:in $ ?cart | |
:where | |
[?e :line_item/cart ?cart] | |
[?e :line_item/content ?content] | |
[?e :line_item/dl_or_ph ?dl_or_ph] | |
[?e :line_item/price ?price] | |
[?content :content/collection ?coll] | |
[?coll :collection/organization ?org] | |
[?org :user/name ?name]] | |
_db cid))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment