Stats card: show started and answered discussions stats (#2849)

* Stats card: show started and answered discussions stats

* trans

* dev
This commit is contained in:
Alexandr Garbuzov
2023-06-19 05:51:58 +02:00
committed by GitHub
parent a5260cb38a
commit 92518e375f
9 changed files with 137 additions and 7 deletions
+10
View File
@@ -63,6 +63,12 @@ const GRAPHQL_STATS_QUERY = `
followers {
totalCount
}
repositoryDiscussions {
totalCount
}
repositoryDiscussionComments(onlyAnswers: true) {
totalCount
}
${GRAPHQL_REPOS_FIELD}
}
}
@@ -190,6 +196,8 @@ const fetchStats = async (
totalCommits: 0,
totalIssues: 0,
totalStars: 0,
totalDiscussionsStarted: 0,
totalDiscussionsAnswered: 0,
contributedTo: 0,
rank: { level: "C", percentile: 100 },
};
@@ -232,6 +240,8 @@ const fetchStats = async (
stats.totalReviews =
user.contributionsCollection.totalPullRequestReviewContributions;
stats.totalIssues = user.openIssues.totalCount + user.closedIssues.totalCount;
stats.totalDiscussionsStarted = user.repositoryDiscussions.totalCount;
stats.totalDiscussionsAnswered = user.repositoryDiscussionComments.totalCount;
stats.contributedTo = user.repositoriesContributedTo.totalCount;
// Retrieve stars while filtering out repositories to be hidden.
+2
View File
@@ -22,6 +22,8 @@ export type StatsData = {
totalCommits: number;
totalIssues: number;
totalStars: number;
totalDiscussionsStarted: number;
totalDiscussionsAnswered: number;
contributedTo: number;
rank: { level: string; percentile: number };
};