From 8e71b1822561cd5c607412e6cb04d050aad8b021 Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Mon, 17 May 2021 20:15:34 +0200 Subject: [PATCH] Add `complete` to line PATCH options. `complete` is a boolean. If true, any virgin points remaining on the line will be marked as `ntba=true`. If false, *all* points on the line will be marked as `ntba=false`. --- lib/www/server/lib/db/line/patch.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/www/server/lib/db/line/patch.js b/lib/www/server/lib/db/line/patch.js index 13d02d8..c764b6b 100644 --- a/lib/www/server/lib/db/line/patch.js +++ b/lib/www/server/lib/db/line/patch.js @@ -7,6 +7,9 @@ async function patch (projectId, line, payload, opts = {}) { "remarks": "UPDATE preplot_lines SET remarks = $2 WHERE line = $1 AND class ='V';", "meta": "UPDATE preplot_lines SET meta = $2 WHERE line = $1 AND class ='V';", "ntba": "UPDATE preplot_lines SET ntba = $2 WHERE line = $1 AND class ='V';", + "complete": "UPDATE preplot_points pp SET ntba = $2 FROM preplot_points_count ppc WHERE pp.line = ppc.line AND pp.point = ppc.point AND pp.line = $1 AND ($2 = false OR ppc.count = 0);" + // NOTE on the "complete" query: if complete is true it sets *only* virgin points to NTBA=true, + // but if complete is false it sets all points on the line to NTBA=false. }; try {