diff --git a/repl/introduce_datascript.clj b/repl/introduce_datascript.clj index 2880be7..4aae263 100644 --- a/repl/introduce_datascript.clj +++ b/repl/introduce_datascript.clj @@ -69,3 +69,9 @@ date))) (sort-by :nb-jours <) (clojure.pprint/print-table)) + +(d/q + '[:find (count ?b) . + :where + [?u :borrowings ?b]] + @conn) diff --git a/src/library_monkey/core.clj b/src/library_monkey/core.clj index ab738ce..7de1a55 100644 --- a/src/library_monkey/core.clj +++ b/src/library_monkey/core.clj @@ -64,21 +64,19 @@ (count (map first (d/q '[:find (pull ?r [:pseudo]) :where [?r :borrowings ?b]] - @conn))) + @conn)))) - ) (defn read-aggregates [conn] (hash-map - :count (ffirst - (d/q - '[:find (count ?b) - :where - [?u :borrowings ?b]] - @conn)) - :reports (map first (d/q '[:find (pull ?r [:pseudo :username :borrowings]) - :where [?r :borrowings ?b]] - @conn))) - ) + :count (d/q + '[:find (count ?b) . + :where + [?u :borrowings ?b]] + @conn) + :reports (d/q '[:find [(pull ?r [:pseudo :username + {:borrowings [:titre :date-de-retour :type-de-document]}]) ...] + :where [?r :borrowings ?b]] + @conn))) (def amiens-library (reify Library