From ff66c9a88d0be8e4bb464212fed1c537ef5f2f8b Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Sat, 8 May 2021 00:20:15 +0200 Subject: [PATCH] Handle planner sequence value for first line in prospect. The next sequence to shoot is normally retrieved from the database via getSequence(), but it returns false if no sequences have been shot yet. In that case we use a default value of `1` to build the name of the planned line. Fixes #81 Fixes #82 --- lib/www/server/lib/db/plan/lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/www/server/lib/db/plan/lib/index.js b/lib/www/server/lib/db/plan/lib/index.js index 2cba5f4..4a5f42b 100644 --- a/lib/www/server/lib/db/plan/lib/index.js +++ b/lib/www/server/lib/db/plan/lib/index.js @@ -92,7 +92,7 @@ async function getLineName (client, projectId, payload) { const attempt = planned.filter(r => r.line == payload.line).concat(previous).length; const p = payload; const incr = p.lsp > p.fsp; - const sequence = p.sequence; + const sequence = p.sequence || 1; const line = p.line; return `${incr?"1":"2"}0${line}${attempt}${sequence.toString().padStart(3, "0")}S00000`; }