diff --git a/.vscode/settings.json b/.vscode/settings.json index 3911202d..25106104 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,6 +4,6 @@ "javascript.implicitProjectConfig.checkJs": true, "javascript.validate.enable": true, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" } } diff --git a/lib/grades/gradeFormat.ts b/lib/grades/gradeFormat.ts index f0404fc7..23114b69 100644 --- a/lib/grades/gradeFormat.ts +++ b/lib/grades/gradeFormat.ts @@ -8,6 +8,9 @@ Agrega puntos, comas, caracteres antes o despues de la nota. * @example const formated = gradeFormat(scale, grade) */ export const gradeFormat = (scale: ScaleAttributes, grade: number): string => { + if (grade === null) { + grade = 0 + } let round = `${gradeRound(scale, grade)}` if (round.length === 1 && scale.append === '' && scale.base !== 'Peru') { diff --git a/lib/grades/gradeRound.ts b/lib/grades/gradeRound.ts index ccf39902..6a441122 100644 --- a/lib/grades/gradeRound.ts +++ b/lib/grades/gradeRound.ts @@ -8,6 +8,9 @@ import { ScaleAttributes } from '../types' export const gradeRound = (scale: ScaleAttributes, grade: number): number => { try { let rounded: number | string + if (grade === null) { + return Number(0) + } if (scale.decimals > 0) { if (scale.decimals === 1) { rounded = Number(