treehouses / treehouses.github.io

A Markdown Wiki for treehouses 🏡
http://treehouses.io
132 stars 107 forks source link

Tracking Progress #199

Closed sonAndrew closed 5 years ago

sonAndrew commented 5 years ago

The "Tracking Progress" page is missing the items below:

Directions

  1. Number of Comments made

Progress

  1. Number of Comments made
CalebProvost commented 5 years ago

@sonAndrew Go ahead and assign this to yourself if you want to work on it. Otherwise its marked ready for anyone.

sriharivishnu commented 5 years ago

@sonAndrew Have you figured out how to do this yet? I took a look and thought of this approach.

Using Github's Search API, the following link gives you all the PRs and Issues in this repository: https://api.github.com/search/issues?q=repo:treehouses/treehouses.github.io&sort=created&order=asc

In each PR and Issue, one of the properties of the object is a comments URL which leads you to a page that lists all the comments on that PR or Issue. "comments_url":"https://api.github.com/repos/treehouses/treehouses.github.io/issues/1/comments"

Here is a general process that will find all comments of a user that are not on a post authored by that user:

  1. Get all Issues and PR with link
  2. Go through each issue/PR and if it is not authored by the specified user, go to the comments_url
  3. Search through all comments and look for comments authored by the specified user
  4. For each comment, increment counter by one
  5. At the end, display the counter value

In terms of efficiency, this could definitely be improved. I could not find a way to go list all comments in a repository using Github's API, but if there was a way, that would make the search much quicker.

sonAndrew commented 5 years ago

Hey, @sriharivishnu thanks for your input. I have created a PR that will do this here