Skip to content

Commit

Permalink
fix: disciplina case
Browse files Browse the repository at this point in the history
  • Loading branch information
Joabesv authored Mar 22, 2024
1 parent dc429a3 commit 0d0ac4d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/helpers/transform/disciplinas.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ module.exports = function convertDisciplina(d) {
disciplina.pop()

// fix disciplina
obj.disciplina = disciplina.join(' ').trim()
const rawDisciplina = disciplina.join(' ').trim()
obj.disciplina = toTitleCase(rawDisciplina)

obj.disciplina_id = obj.id
if(obj.codigo != null) {
Expand Down Expand Up @@ -123,4 +124,12 @@ function extractCampus(d) {
}

return null
}
}


function toTitleCase(str) {
return str.replace(
/\w\S*/g,
(txt) => txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase(),
);
}

0 comments on commit 0d0ac4d

Please sign in to comment.