From 71eb6b34ce80cc91ab1e713f2c5b32076c3ee940 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Tue, 20 Feb 2018 00:21:24 -0300 Subject: Simplifies q-job and doc --- src/clj/queue_api/db/core.clj | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/clj/queue_api') diff --git a/src/clj/queue_api/db/core.clj b/src/clj/queue_api/db/core.clj index faa4d65..e0eb491 100644 --- a/src/clj/queue_api/db/core.clj +++ b/src/clj/queue_api/db/core.clj @@ -52,18 +52,18 @@ `s`: status of the job `ts`: types of the job" [u s & ts] - (let [q (->> (d/q '[:find ?d ?id - :in $ ?u ?s ?ts - :where - [?e :job/date ?d] - [?e :job/id ?id] - [?e :job/urgent ?u] - [?e :job/status ?s] - [?e :job/type ?t] - [(clojure.string/includes? ?ts ?t)]] - @conn u s ts) - (sort-by first))] - (map #(d/entity @conn [:job/id (last %)]) q))) + (->> (d/q '[:find ?d ?id + :in $ ?u ?s ?ts + :where + [?e :job/date ?d] + [?e :job/id ?id] + [?e :job/urgent ?u] + [?e :job/status ?s] + [?e :job/type ?t] + [(clojure.string/includes? ?ts ?t)]] + @conn u s ts) + (sort-by first) + (map #(d/entity @conn [:job/id (last %)])))) (defn q-status "Query job filtering only by `s`" @@ -112,7 +112,9 @@ p (q-skillset (:agent/secondary-skillset a))))))) -(defn t-job +(defn + "Transact status `s` and agent `a` of a job `id`" + t-job ([^String id ^Keyword s] (d/transact! conn [{:job/id id :job/status s}])) -- cgit v1.2.3