Skip to content

Commit

Permalink
Revert xo changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdesboeufs committed Oct 30, 2019
1 parent f025d5d commit 6d2a514
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions improve-csv.js
Expand Up @@ -84,7 +84,7 @@ function convertRow(row, {culturesMap, culturesSpecialesMap}) {

if (commune.code !== communeActuelleCadastre.code) {
converted.ancien_id_parcelle = idParcelle
converted.id_parcelle = `${communeActuelle.code}${commune.code.slice(2, 3)}${idParcelle.slice(8)}`
converted.id_parcelle = `${communeActuelle.code}${commune.code.substr(2, 3)}${idParcelle.substr(8)}`
}
}

Expand Down Expand Up @@ -130,7 +130,7 @@ async function main() {
if (process.env.DISABLE_GEOCODING !== '1') {
console.log('Géocodage à la parcelle')

const communesRows = groupBy(rows, r => r.id_parcelle.slice(0, 5))
const communesRows = groupBy(rows, r => r.id_parcelle.substr(0, 5))
await bluebird.map(Object.keys(communesRows), async codeCommune => {
const communeRows = communesRows[codeCommune]
const parcelles = await getParcellesCommune(codeCommune)
Expand Down
2 changes: 1 addition & 1 deletion lib/parse.js
Expand Up @@ -12,7 +12,7 @@ function getPrefixeSection(row) {

function getDateMutation(row) {
const rawDateMutation = row['Date mutation']
return `${rawDateMutation.slice(6, 4)}-${rawDateMutation.slice(3, 2)}-${rawDateMutation.slice(0, 2)}`
return `${rawDateMutation.substr(6, 4)}-${rawDateMutation.substr(3, 2)}-${rawDateMutation.substr(0, 2)}`
}

function getIdParcelle(row) {
Expand Down
4 changes: 2 additions & 2 deletions lib/recog.js
Expand Up @@ -30,7 +30,7 @@ connectGraph(historiqueCommunes)
const byCodeCommune = groupBy(historiqueCommunes.concat(arrondissementsMunicipaux), h => `${h.type}${h.code}`)

function getCodeDepartement(codeCommune) {
return codeCommune.startsWith('97') ? codeCommune.slice(0, 3) : codeCommune.slice(0, 2)
return codeCommune.startsWith('97') ? codeCommune.substr(0, 3) : codeCommune.substr(0, 2)
}

function isValidAt(communeEntry, dateValeur) {
Expand Down Expand Up @@ -59,7 +59,7 @@ function getCommuneFromCadastre(codeCommune, prefixeSection) {
return getOlderCommune(codeCommune)
}

const code1 = `${codeCommune.slice(0, 2)}${prefixeSection}`
const code1 = `${codeCommune.substr(0, 2)}${prefixeSection}`
const commune1 = getOlderCommune(code1)

if (commune1) {
Expand Down
5 changes: 4 additions & 1 deletion package.json
Expand Up @@ -31,7 +31,10 @@
},
"xo": {
"semicolon": false,
"space": "2"
"space": "2",
"rules": {
"unicorn/prefer-string-slice": "off"
}
},
"engines": {
"node": ">= 10"
Expand Down

0 comments on commit 6d2a514

Please sign in to comment.