Add exporting of missing shots.

It is enabled by default but the user should pass
`missing=t` (or some other truty value) in the query
part of the request.
This commit is contained in:
D. Berge
2020-10-04 03:49:04 +02:00
parent d3d535a8be
commit 963f75fd51

View File

@@ -6,6 +6,7 @@ function transform (events, sequences, opts = {}) {
const dgl = !!opts.projectId;
const exportQC = opts.exportQC !== false;
const exportGeneral = opts.exportGeneral !== false;
const exportMissing = opts.exportMissing !== false;
const output = {
DglProjectId: opts.projectId,
@@ -272,6 +273,15 @@ function transform (events, sequences, opts = {}) {
SequenceObject.Entries.push(lsp);
}
}
// Set the missing shots object if not inhibited by the user.
if (exportMissing) {
// The user also needs to request missing shots from the sequences
// endpoint; these are not returned by default.
if ("missing_final" in sequence) {
SequenceObject.MissingShots = sequence.missing_final.map(s => s.point).sort();
}
}
}
return output;
@@ -280,7 +290,7 @@ function transform (events, sequences, opts = {}) {
const seis = async function (req, res, next) {
try {
const events = await event.list(req.params.project, req.query);
const sequences = await sequence.list(req.params.project);
const sequences = await sequence.list(req.params.project, req.query);
const response = transform(events, sequences, {projectId: req.params.project});
res.status(200).send(response);
next();