Skip to content

Commit fc3e9b4

Browse files
committed
fix:leetcode:total submission == 0 NaN%
1 parent 797eb9c commit fc3e9b4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

leetcode.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ exports.getLeetCodeStats = async function getLeetCodeStats() {
5656
const totalSubmission = matchedUser.submitStats.totalSubmissionNum[i].submissions
5757
let question = {
5858
"difficulty": difficulty,
59-
"acceptedRate": (acSubmission / totalSubmission * 100),
59+
"acceptedRate": totalSubmission == 0 ? 0.0 : (acSubmission / totalSubmission * 100),
6060
"solvedRadio": accepted + "/" + allQuestion
6161
}
6262
result.solved.push(question)

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "leetcode-box",
3-
"version": "0.1.0",
3+
"version": "0.1.2",
44
"description": "Update a gist to contain your leetcode stats",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)