minor fixes
This commit is contained in:
@ -158,6 +158,9 @@ async function importCsv(doc) {
|
||||
newE[field] = '';
|
||||
}
|
||||
});
|
||||
// if(newE['materialname'] === '') { // TODO: is this replacement okay?
|
||||
// newE['materialname'] = newE['material'];
|
||||
// }
|
||||
if (newE['supplier'] === '') { // empty supplier fields
|
||||
newE['supplier'] = 'unknown';
|
||||
}
|
||||
@ -208,7 +211,7 @@ async function allDpts() {
|
||||
res.data.forEach(sample => {
|
||||
sampleIds[sample.number] = sample._id;
|
||||
});
|
||||
const dptRegex = /(.*?)_(.*?)_(\d+|\w+_\d+).DPT/;
|
||||
const dptRegex = /(.*?)_(.*?)_(\d+|[a-zA-Z0-9]+_\d+).DPT/;
|
||||
const dpts = fs.readdirSync(dptFiles);
|
||||
for (let i in dpts) {
|
||||
const regexRes = dptRegex.exec(dpts[i])
|
||||
@ -269,8 +272,8 @@ async function allKfVz() {
|
||||
password: 'Abc123!#'
|
||||
}
|
||||
});
|
||||
const kf_template = res.data.find(e => e.name === 'kf')._id;
|
||||
const vz_template = res.data.find(e => e.name === 'vz')._id;
|
||||
const kf_template = res.data.filter(e => e.name === 'kf').sort((a, b) => b.version - a.version)[0]._id;
|
||||
const vz_template = res.data.filter(e => e.name === 'vz').sort((a, b) => b.version - a.version)[0]._id;
|
||||
res = await axios({
|
||||
method: 'get',
|
||||
url: host + '/samples?status=all',
|
||||
@ -380,7 +383,7 @@ async function allSamples() {
|
||||
continue;
|
||||
}
|
||||
samples.push({
|
||||
number: sample['samplenumber'],
|
||||
number: sample['samplenumber'].replace(/[A-Z][a-z]0\d_/, ''), // remove leading An_01 and Eh_01
|
||||
type: sampleType(sample['granulate/part']),
|
||||
batch: sample['charge/batch'],
|
||||
material_id: material._id,
|
||||
|
Reference in New Issue
Block a user