From 0b8277f72cdc2ed2abeb566f30958bd8e0dc5167 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Wed, 21 Feb 2018 22:41:20 -0300 Subject: Readme and validation --- src/clj/queue_api/db/core.clj | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/clj/queue_api/db') diff --git a/src/clj/queue_api/db/core.clj b/src/clj/queue_api/db/core.clj index c76f0fb..0482feb 100644 --- a/src/clj/queue_api/db/core.clj +++ b/src/clj/queue_api/db/core.clj @@ -102,7 +102,12 @@ (if (seq jn) (first jn)))))) -(defn request-job +(defn agent + "Get a agent by id" + [id] + (d/entity @conn [:agent/id id])) + +(defn fittest-job "Get the fittest job for a agent `id`." [^String id] (let [a (d/entity @conn [:agent/id id])] @@ -146,7 +151,7 @@ [^String id] (let [a (d/entity @conn [:agent/id id])] (if-not (nil? a) - (let [jid (:job/id (request-job id))] + (let [jid (:job/id (fittest-job id))] (end-job a) (start-job id jid) jid)))) \ No newline at end of file -- cgit v1.2.3