psss / did

What did you do last week, month, year?
https://did.readthedocs.io/
GNU General Public License v2.0
245 stars 103 forks source link

Github "issues commented" includes comments by other users #325

Open nikic opened 9 months ago

nikic commented 9 months ago

The "issues commented" are currently computed like this: https://github.com/psss/did/blob/e1e3de7a7c7c3d80484292c9e926651d3baafdd1/did/plugins/github.py#L168

What this gives you is any issues that a) I commented on and b) that were updated in the date period. This means that if I commented on an issue at some point, and then someone else leaves a comment on it in the date period, then it will be reported as if I commented that week, which is probably not what was intended?

The same issue exists for "pull requests commented".

nikic commented 9 months ago

I think there are other related issues as well, e.g. it looks like "issues closed" is determined based on issues closed in the time frame where I am the assignee, rather than issues that I closed.

It's probably not possible to implemented correct behavior using the search API. I found that there is an API for getting events for a user: https://docs.github.com/en/rest/activity/events?apiVersion=2022-11-28#list-public-events-for-a-user This does seem to provide the necessary information to correctly determine all the issues/PRs a user interacted with in a specific way.

However, that API does not seem to allow specifying a time range, so one would have to scan the feed backwards from the current time. This would only work for recent date ranges.

psss commented 8 months ago

Yes, sometimes the stats are tricky and hard to be extracted correctly. For some plugins we do some additional filtering of the detailed history. We could perhaps do something similar for the github plugin as well.

Felixoid commented 3 months ago

Hi-hi! I started using the program recently and love it!

However, I faced precisely the same issue described here. Reading the GH API documentation doesn't help. The events API does not provide a way to filter them by dates.

What we can use is additional filtering for the comments and review comments like here:

https://api.github.com/repos/ClickHouse/ClickHouse/issues/56317/comments?since=2023-11-15&sort=created https://api.github.com/repos/ClickHouse/ClickHouse/pulls/56317/comments?since=2023-11-15&sort=created

The first link is for normal comments in the PRs and issues, and the latter one is for the review comments.

Felixoid commented 3 months ago

I've implemented the filter in #363, but I've found that the PullRequestsReviewed has a very solid query, so it's unnecessary to use https://api.github.com/repos/ClickHouse/ClickHouse/pulls/56317/comments?since=2023-11-15&sort=created there