From 66db3e26b77b8ded7395b068f645bcca30d3247c Mon Sep 17 00:00:00 2001 From: AayushSaini101 Date: Wed, 24 Jul 2024 19:05:00 +0530 Subject: [PATCH] Fix undefined error --- .github/scripts/vote_tracker.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/scripts/vote_tracker.js b/.github/scripts/vote_tracker.js index 0e8889e90..cebf944ea 100644 --- a/.github/scripts/vote_tracker.js +++ b/.github/scripts/vote_tracker.js @@ -179,6 +179,7 @@ module.exports = async ({ context }) => { console.error('Error reading voteTrackingFile.json:', readError); throw readError; } + let updatedVoteDetails = [...voteDetails] const updatedTSCMembers = []; const requiredKeys = ['name', 'lastParticipatedVoteTime', 'isVotedInLast3Months', 'lastVoteClosedTime', 'agreeCount', 'disagreeCount', 'abstainCount', 'notParticipatingCount']; // Function to check if an object has all required keys @@ -230,18 +231,19 @@ module.exports = async ({ context }) => { } else { console.log('No valid example member found in voteDetails.'); } - + if (updatedTSCMembers.length > 0) { try { const combinedData = [...voteDetails, ...updatedTSCMembers]; await writeFile(voteTrackingFile, JSON.stringify(combinedData, null, 2)); - return combinedData; // Return the updated data + updatedVoteDetails = [...combinedData] } catch (writeError) { console.error('Error wile writing file:' ,writeError) } } + return combinedData } } catch (error) { console.error('Error while running the vote_tracker workflow:', error); } -} +} \ No newline at end of file