Skip to content

Commit

Permalink
Change to fix issues with missing leading 0 e.g 1165 instead of 01165
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasG77 committed Feb 20, 2023
1 parent d79647e commit a528228
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions build/cog.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ async function extractCommunes(communesPath, mouvementsCommunesPath, arrondissem
const chefsLieuxArrondissement = arrondissements.map(r => r.chefLieu)

const mouvementsRows = await readCsvFile(mouvementsCommunesPath)
// Fix issue with wrong length (data with missing leading 0)
mouvementsRows.forEach(mvt => {
if (mvt.COM_AV.length === 4) {
mvt.COM_AV = '0' + mvt.COM_AV
}

if (mvt.COM_AP.length === 4) {
mvt.COM_AP = '0' + mvt.COM_AP
}
})
const anciensCodesIndex = computeAnciensCodesCommunes(communesRows, mouvementsRows)

const communes = communesRows.map(row => {
Expand Down

0 comments on commit a528228

Please sign in to comment.