From 4fd64ff344a7160035b7928e9f326eddd2ff9f55 Mon Sep 17 00:00:00 2001 From: olrlobt <317tmdgjs@naver.com> Date: Tue, 5 Mar 2024 01:18:06 +0900 Subject: [PATCH] fix(stats card): fetch total commits from the current year only --- src/fetchers/stats-fetcher.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/fetchers/stats-fetcher.js b/src/fetchers/stats-fetcher.js index 115cd50a51564..8d44704361f65 100644 --- a/src/fetchers/stats-fetcher.js +++ b/src/fetchers/stats-fetcher.js @@ -40,11 +40,11 @@ const GRAPHQL_REPOS_QUERY = ` `; const GRAPHQL_STATS_QUERY = ` - query userInfo($login: String!, $after: String, $includeMergedPullRequests: Boolean!, $includeDiscussions: Boolean!, $includeDiscussionsAnswers: Boolean!) { + query userInfo($login: String!, $from: DateTime, $after: String, $includeMergedPullRequests: Boolean!, $includeDiscussions: Boolean!, $includeDiscussionsAnswers: Boolean!) { user(login: $login) { name login - contributionsCollection { + contributionsCollection(from: $from) { totalCommitContributions, totalPullRequestReviewContributions } @@ -122,10 +122,13 @@ const statsFetcher = async ({ let stats; let hasNextPage = true; let endCursor = null; + const currentYear = new Date().getFullYear(); + const from = `${currentYear}-01-01T00:00:00Z`; while (hasNextPage) { const variables = { login: username, first: 100, + from, after: endCursor, includeMergedPullRequests, includeDiscussions,