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

fix review count #198

Closed

Conversation

konavivekramakrishna
Copy link

@konavivekramakrishna konavivekramakrishna commented Jan 2, 2024

Fixes #105

Before:
image

After:
image

Copy link

vercel bot commented Jan 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
leaderboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 31, 2024 0:39am

@konavivekramakrishna
Copy link
Author

@rithviknishad

could you please review it

lib/api.ts Outdated Show resolved Hide resolved
lib/api.ts Outdated Show resolved Hide resolved
@@ -191,10 +197,27 @@ export function getCalendarData(activity: Activity[]) {
};
}
acc[date].count += 1;

const uniquePrReviews = new Set();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why there are Two sets? All Unique and Unique? Could you explain the algorithm for how you are solving the problem?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AllUnq set is used to count the total unique pull requests (PRs) reviewed.

and the 2nd set is For PRs reviewed in the last 7 days, we calculate and count the reviews for each date (day) and sum them up over this period.

In this process, if a PR has multiple reviews on the same day or on subsequent days, it is only counted once for its first review. Any subsequent reviews of the same PR are not counted again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@konavivekramakrishna multiple distinct reviews on the same PR must be counted. But we shouldn't count the individual review comment on the PR. We should only count one review event.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rithviknishad
For example, in the following pr: coronasafe/care_fe#6479

what should be the count of pr_reviewed

The count of 'pr_reviewed' for this pull request in the current staging leaderboard is 13

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@konavivekramakrishna multiple distinct reviews on the same PR must be counted. But we shouldn't count the individual review comment on the PR. We should only count one review event.

@rithviknishad are you referring to multiple individuals reviewing the same pull request, or do you mean counting multiple distinct reviews by a single person?"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. For example, the recent review I've made on your PR in care (coronasafe/care_fe#7152 (review)), I've only requested changes ONCE (and you might have also got a mail notification once for the same). However, leaderboard shows 2 review events even though I've made only 1 review event.

image image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review event seems to be having an ID. Could you update the types? Or if we are not scrapping the ID, can we adjust the scraper to report only one review event for an ID?

@konavivekramakrishna
Copy link
Author

konavivekramakrishna commented Jan 31, 2024

@rithviknishad

can you please check

@rithviknishad
Copy link
Member

image

@rithviknishad
Copy link
Member

@konavivekramakrishna conversation #198 (comment) has not been resolved

@rithviknishad
Copy link
Member

@konavivekramakrishna any updates on this?

@rithviknishad
Copy link
Member

Closing this PR due to no activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in the reviews count
2 participants