From c6f5186f7ea8bc933a613420fff59b4a83ff2f19 Mon Sep 17 00:00:00 2001 From: VLE2FE Date: Sun, 16 Aug 2020 20:01:18 +0200 Subject: [PATCH] debug --- data_import/import.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/data_import/import.js b/data_import/import.js index e79364f..6e8f870 100644 --- a/data_import/import.js +++ b/data_import/import.js @@ -9,8 +9,8 @@ const _ = require('lodash'); const stages = { materials: true, - samples: true, - dpt: true + samples: false, + dpt: false } const docs = [ @@ -30,8 +30,8 @@ const docs = [ const errors = []; const nmDocs = 'C:\\Users\\vle2fe\\Documents\\Data\\All_200807\\nmDocs'; // NormMaster Documents const dptFiles = 'C:\\Users\\vle2fe\\Documents\\Data\\All_200807\\DPT'; // Spectrum files -// const host = 'http://localhost:3000'; -const host = 'https://definma-api.apps.de1.bosch-iot-cloud.com'; +const host = 'http://localhost:3000'; +// const host = 'https://definma-api.apps.de1.bosch-iot-cloud.com'; const requiredProperties = ['samplenumber','materialnumber','materialname','supplier','reinforcementmaterial','material','granulate/part','color','charge/batch','comments']; dict = { // dictionary 'Granulat': 'granulate', @@ -62,7 +62,7 @@ async function main() { for (let i in docs) { await importCsv(docs[i]); await allMaterials(); - await saveMaterials(); + // await saveMaterials(); } fs.writeFileSync('./data_import/numberToColor.json', JSON.stringify(numberToColor)); } @@ -651,6 +651,9 @@ async function allMaterials() { // process all samples for (let index in data) { let sample = data[index]; + if (sample['materialname'].replace(/\s+/g, '') === 'Latamid66H2G30') { + console.log(sample); + } if (sample['supplier'] === '') { // empty supplier fields sample['supplier'] = 'unknown'; } @@ -676,7 +679,7 @@ async function allMaterials() { } } else { // new material - console.info(`MATERIAL LOAD ${index}/${data.length} ${sample['materialname']}`); + // console.info(`MATERIAL LOAD ${index}/${data.length} ${sample['materialname']}`); materials[sample['materialname']] = { name: trim(sample['materialname']), supplier: trim(sample['supplier']),