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
This commit is contained in:
D. Berge
2021-05-08 00:20:15 +02:00
parent 56d30d48c5
commit ff66c9a88d

View File

@@ -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`;
}