From aa9ac03a601feff7c4977e8eaf64b5211a8b95ad Mon Sep 17 00:00:00 2001 From: Rohan Parab <144143093+Rohan20-10@users.noreply.github.com> Date: Wed, 6 Nov 2024 23:29:44 +0530 Subject: [PATCH] Contributions count not updating #303 --- website/scripts/contributor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/scripts/contributor.js b/website/scripts/contributor.js index 4ad3bbf..5037a8a 100644 --- a/website/scripts/contributor.js +++ b/website/scripts/contributor.js @@ -17,7 +17,7 @@ async function fetchData() { // Render stats function renderStats(repoStats, contributors) { const statsGrid = document.getElementById('statsGrid'); - const totalContributions = contributors.reduce((sum,contributor) => sum + contributor.contributions,0); + const totalContributions = contributors?.reduce((sum,contributor) => sum + contributor.contributions,0) || 0; const stats = [ { label: 'Contributors', value: contributors.length, icon: 'users' }, { label: 'Total Contributions', value: totalContributions, icon: 'git-commit' }, @@ -106,4 +106,4 @@ function scrollToContribute() { } // Initialize the page when the DOM is loaded -document.addEventListener('DOMContentLoaded', init); \ No newline at end of file +document.addEventListener('DOMContentLoaded', init);