Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download badge counts wrong #30

Closed
rm-hull opened this issue Jul 19, 2016 · 1 comment
Closed

Download badge counts wrong #30

rm-hull opened this issue Jul 19, 2016 · 1 comment

Comments

@rm-hull
Copy link
Contributor

rm-hull commented Jul 19, 2016

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
Copy link
Member

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

podviaznikov added a commit that referenced this issue Jul 21, 2016
Fetch from clojars by owner/reo-name first - fixes #30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants