-
Notifications
You must be signed in to change notification settings - Fork 0
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
Score cli #1
base: master
Are you sure you want to change the base?
Score cli #1
Changes from all commits
5077421
3a5b1ee
f40f3cf
dfd4ad5
87dcaf4
d6ab542
8d54f59
90a733f
8aea71c
057061a
cb3f525
ca0a3c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,30 @@ | |
(let [s (user key)] | ||
(subs s 0 (- (.length s) (.length "{/privacy}"))))) | ||
|
||
;;Get Url Events of Barista Public Members | ||
(defn members-url-events [org-name] | ||
(map (partial get-value "events_url") (parse->clojure (str base-url "/orgs/" org-name "/members")))) | ||
(defn members-url-events | ||
([org-name] | ||
"Get Url Events of Public Members for org-name" | ||
(map (partial get-value "events_url") (parse->clojure (str base-url "/orgs/" org-name "/members")))) | ||
([org-name token] | ||
"Get Url Events for all Member for org-ame. Requires token and be member" | ||
(map (partial get-value "events_url") (parse->clojure (str base-url "/orgs/" org-name "/members?access_token=" token))))) | ||
|
||
(members-url-events "BaristaVentures") | ||
(defn count-user-pr [user-events] | ||
"Count User Pull Request Events" | ||
(reduce (fn [final-prs pr] | ||
(let [{type "type" date "created_at" {name "name"} "repo" {login "login"} "actor"} pr] | ||
(if (and (= type "PullRequestEvent") (.startsWith date "2016-10")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. October is hardcoded, what if you make the date an argument? |
||
(if (empty? final-prs) | ||
{:user login :score 1 :last date} | ||
(assoc final-prs :score (inc (:score final-prs)))) | ||
final-prs))) | ||
'() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if you apply a PullRequestEvent+Date |
||
user-events)) | ||
|
||
;;Get Members Score | ||
(defn -main [& args] | ||
(println "User - Score") | ||
(apply println (map (fn [m] (str "\n" (:user m) " - " (:score m))) | ||
(sort-by :score > (filter (fn [x] (> (count x) 0)) | ||
(map count-user-pr | ||
(map parse->clojure (apply members-url-events args)))))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this
let
could be avoided if you do some destructuring at function signature