Feature: Stats card: Show merged PRs count and percentage (#3003)

* Feature: Stats card: Show merged PRs count and percentage

* dev

* dev

* renames
This commit is contained in:
Alexandr Garbuzov
2023-08-14 02:18:57 +03:00
committed by GitHub
parent 135176f073
commit a258b29db5
9 changed files with 140 additions and 7 deletions
+8
View File
@@ -54,6 +54,9 @@ const GRAPHQL_STATS_QUERY = `
pullRequests(first: 1) {
totalCount
}
mergedPullRequests: pullRequests(states: MERGED) {
totalCount
}
openIssues: issues(states: OPEN) {
totalCount
}
@@ -201,6 +204,8 @@ const fetchStats = async (
const stats = {
name: "",
totalPRs: 0,
totalPRsMerged: 0,
mergedPRsPercentage: 0,
totalReviews: 0,
totalCommits: 0,
totalIssues: 0,
@@ -246,6 +251,9 @@ const fetchStats = async (
}
stats.totalPRs = user.pullRequests.totalCount;
stats.totalPRsMerged = user.mergedPullRequests.totalCount;
stats.mergedPRsPercentage =
(user.mergedPullRequests.totalCount / user.pullRequests.totalCount) * 100;
stats.totalReviews =
user.contributionsCollection.totalPullRequestReviewContributions;
stats.totalIssues = user.openIssues.totalCount + user.closedIssues.totalCount;
+2
View File
@@ -18,6 +18,8 @@ export type RepositoryData = {
export type StatsData = {
name: string;
totalPRs: number;
totalPRsMerged: number;
mergedPRsPercentage: number;
totalReviews: number;
totalCommits: number;
totalIssues: number;