From 0dc09db4e7c040659f4d452d770878504cebfff6 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sun, 17 Dec 2023 16:34:03 -0300 Subject: [PATCH] fix(basic.gblib): Allow MERGE keyword in storage #380. @othonlima --- packages/basic.gblib/services/SystemKeywords.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/basic.gblib/services/SystemKeywords.ts b/packages/basic.gblib/services/SystemKeywords.ts index 82ae8bcd..5cc648f0 100644 --- a/packages/basic.gblib/services/SystemKeywords.ts +++ b/packages/basic.gblib/services/SystemKeywords.ts @@ -2085,14 +2085,16 @@ export class SystemKeywords { */ public async merge({ pid, file, data, key1, key2 }): Promise { + if (!data || data.length === 0) { + GBLog.verbose(`BASIC: MERGE running on ${file}: NO DATA.`); + return data; + } + + GBLog.info(`BASIC: MERGE running on ${file} and key1: ${key1}, key2: ${key2}...`); if (!this.cachedMerge[pid]) { this.cachedMerge[pid] = { file: {} } } - if (!data) { - GBLog.info(`BASIC: MERGE running on ${file}: NO DATA.`); - return data; - } const { min, user, params } = await DialogKeywords.getProcessInfo(pid); @@ -2398,7 +2400,7 @@ export class SystemKeywords { await this.saveToStorageBatch({ pid, table: file, rows: fieldsValuesList }); } - GBLog.info(`BASIC: MERGE updated (merges:${merges}, additions:${adds}, skipped: ${skipped}).`); + GBLog.info(`BASIC: MERGE results: merges:${merges}, additions:${adds}, skipped: ${skipped}.`); return table; }