hashobject / jarkeeper.com

Identify outdated dependencies for Clojure repo
https://jarkeeper.com
Eclipse Public License 1.0
20 stars 11 forks source link

Download badge counts wrong #30

Closed rm-hull closed 8 years ago

rm-hull commented 8 years ago

Hi,

Wondering if the logic in https://github.com/hashobject/jarkeeper.com/blob/master/src/jarkeeper/downloads.clj#L32-L37 is correct?

(defn get-downloads [repo-owner repo-name]
  (let [resp-by-short-name (clojars-fetch repo-name)
        resp-by-full-name (clojars-fetch (str repo-owner "/" repo-name))]
    (if (= 200 (:status resp-by-short-name))
      (some-> resp-by-short-name :body :downloads)
      (some-> resp-by-full-name :body :downloads))))

For example, one of my jars (https://clojars.org/rm-hull/turtle) has 439 downloads, but your badge for it (https://jarkeeper.com/rm-hull/turtle/downloads.svg) shows 16 downloads: this is because https://clojars.org/turtle has 16 downloads.

This is because the code checks the resp-by-short-name first... seems like it ought check the status on resp-by-full-name and use that first instead ?!?

Happy to provide a PR to fix this if you agree

Thanks, Richard

podviaznikov commented 8 years ago

Yeah, you are correct, seems like the bug with the logic. Would love PR!