diff --git a/src/clj/commiteth/routes/services.clj b/src/clj/commiteth/routes/services.clj index 5057eb5..8bb70db 100644 --- a/src/clj/commiteth/routes/services.clj +++ b/src/clj/commiteth/routes/services.clj @@ -61,18 +61,22 @@ github-repos)))) +(defn ^:private enrich-owner-bounties [owner-bounty] + (let [state (bounties/bounty-state owner-bounty) + claims (map + #(update % :value_usd usd-decimal->str) + (bounties-db/bounty-claims (:issue_id owner-bounty)))] + (-> owner-bounty + (update :value_usd usd-decimal->str) + (assoc :claims claims) + (assoc :state state)))) + (defn user-bounties [user] (let [owner-bounties (bounties-db/owner-bounties (:id user))] - (into {} - (for [ob owner-bounties - :let [b (update ob :value_usd usd-decimal->str)]] - [(:issue_id b) - (conj b - (let [claims (map - #(update % :value_usd usd-decimal->str) - (bounties-db/bounty-claims (:issue_id b)))] - {:claims claims}))])))) - + (->> owner-bounties + (map enrich-owner-bounties) + (map (juxt :issue_id identity)) + (into {})))) (defn top-hunters [] (let [renames {:user_name :display-name