From 7cf739f74cf9ec816ab77783ba3c46e85f6ae921 Mon Sep 17 00:00:00 2001 From: Maud Royer Date: Tue, 23 Jul 2024 14:17:36 +0200 Subject: [PATCH] fix: plus de combinaisons de versions Signed-off-by: Maud Royer --- bin/import-pac-declare.js | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/bin/import-pac-declare.js b/bin/import-pac-declare.js index 3d7c91e..f515468 100755 --- a/bin/import-pac-declare.js +++ b/bin/import-pac-declare.js @@ -156,22 +156,6 @@ if (process.argv.length < 4) { }) } - let firstRecord = null - const currentRecord = await pool.query(/* sql */ - ` - SELECT cartobio_operators.record_id - FROM cartobio_operators - LEFT JOIN cartobio_parcelles cp on cartobio_operators.record_id = cp.record_id - WHERE numerobio = $1 - AND numero_pacage = $2 LIMIT 1 - `, - [operator.numerobio, pacage] - ) - - if (currentRecord.rows.length) { - firstRecord = await getRecord(currentRecord.rows[0].record_id) - } - /** * @type {import('../outputs/types/record').NormalizedRecord} */ @@ -191,13 +175,7 @@ if (process.argv.length < 4) { } } - const newRecord = normalizeRecord(await createOrUpdateOperatorRecord(record, { copyParcellesData: true }, client)) - if (firstRecord) { - await patchFeatureCollection({ record: firstRecord }, newRecord.parcelles.features) - await pool.query(` - DELETE FROM cartobio_operators WHERE record_id = $1 - `, [newRecord.record_id]) - } + await createOrUpdateOperatorRecord(record, { copyParcellesData: true }, client) i++ progress.increment() }