Skip to content

Commit

Permalink
fix: Correctif sur la récuperation des parcelles déssinées
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoireDucharme committed Nov 29, 2024
1 parent e9dd7bb commit ee26516
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/providers/cartobio.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ async function createOrUpdateOperatorRecord (record, context = {}, customClient)
)
AND cartobio_operators.record_id = $18
AND cartobio_operators.deleted_at IS NULL
AND cartobio_parcelles.deleted_at IS NULL
AND $17
ORDER BY created_at DESC
LIMIT 1
Expand Down Expand Up @@ -295,8 +296,9 @@ async function createOrUpdateOperatorRecord (record, context = {}, customClient)
SELECT record_id
FROM cartobio_operators
WHERE numerobio = $2
AND cartobio_operators.record_id = $1
AND cartobio_operators.record_id = $3
AND cartobio_operators.deleted_at IS NULL
AND cartobio_parcelles.deleted_at IS NULL
ORDER BY created_at DESC
LIMIT 1
)
Expand All @@ -305,7 +307,7 @@ async function createOrUpdateOperatorRecord (record, context = {}, customClient)
ON CONFLICT (record_id, id) DO NOTHING
RETURNING *, ST_AsGeoJSON(geometry)::json as geometry
`,
[context.previousRecordId, result.rows.at(0).numerobio]
[result.rows.at(0).record_id, result.rows.at(0).numerobio, context.previousRecordId]
)
parcelles.push(...addedParcelles.rows)
}
Expand Down
32 changes: 32 additions & 0 deletions migrations/20241105140322-add-delete-column-parcelles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"use strict";

var dbm;
var type;
var seed;

exports.setup = function (options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
};

exports.up = async function (db) {
await db.addColumn("cartobio_parcelles", "deleted_at", {
type: "datetime",
notNull: false,
});
await db.addColumn("cartobio_parcelles", "from_parcelles", {
type: "string",
length: 255,
notNull: false,
});
};

exports.down = async function (db) {
await db.removeColumn("cartobio_parcelles", "deleted_at");
await db.removeColumn("cartobio_parcelles", "from_parcelles");
};

exports._meta = {
version: 1,
};

0 comments on commit ee26516

Please sign in to comment.