Fixes #2 [FE] Fix cert generation with <empty> label generating a literal <empty> in the docx

master
Araozu 2023-09-20 11:31:09 -05:00
parent 2d18349d5b
commit 999266b99e
1 changed files with 6 additions and 2 deletions

View File

@ -147,14 +147,18 @@ function RegisterEl(props: {register: Register, person: Person, onClick: () => v
const generator = certGenerator[courseN]; const generator = certGenerator[courseN];
if (generator === undefined) { if (generator === undefined) {
console.error(`Generator function with key \`${courseN}\` not found`); alert(`Generator function with key \`${courseN}\` not found`);
return; return;
} }
const {year, month, day} = dateComponents(); const {year, month, day} = dateComponents();
const personFullName = `${person.person_names} ${person.person_paternal_surname} ${person.person_maternal_surname}`; const personFullName = `${person.person_names} ${person.person_paternal_surname} ${person.person_maternal_surname}`;
const certCustomLabel = customLabelsMap()[register.register_custom_label]?.custom_label_value ?? ""; // Manage custom label
const certCustomLabel = register.register_custom_label === 1
? ""
: customLabelsMap()[register.register_custom_label]?.custom_label_value ?? "";
generator(`${courseN} - ${personFullName}.docx`, { generator(`${courseN} - ${personFullName}.docx`, {
matpel: null, matpel: null,