Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Commit

Permalink
fix(parser): NaN -> null
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Feb 2, 2024
1 parent 5550dc8 commit 8ca3000
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,23 @@ export const dumpSignatureResponse = (html: string): SignaturesDump => {
}

const [shortModuleName, ...fullModuleNameParts] = moduleData[0].split(" ");
const average = parseFloat(moduleData[1]);

modules.push({
id: shortModuleName,
name: fullModuleNameParts.join(" "),
average: parseFloat(moduleData[1]),
average: isNaN(average) ? null : average,
absences: parseInt(moduleData[2]) || 0,
coefficient: parseFloat(moduleData[3])
});
});

const globalAverage = parseFloat(skillGlobalData[1]);

skills.push({
id: shortSkillName,
name: fullSkillNameParts.join(" "),
globalAverage: parseFloat(skillGlobalData[1]),
globalAverage: isNaN(globalAverage) ? null : globalAverage,
absences: parseInt(skillGlobalData[2]) || 0,
coefficient: parseFloat(skillGlobalData[3]),
modules
Expand Down

0 comments on commit 8ca3000

Please sign in to comment.