From 57eca9b2672cc988fcee5730b65c598fb008d9ac Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 9 Jan 2024 15:21:26 +0100 Subject: [PATCH] fix: refs #6630 getLogTree grouping fixed --- src/components/common/VnLog.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/common/VnLog.vue b/src/components/common/VnLog.vue index 14e4789fc..b0a9f230c 100644 --- a/src/components/common/VnLog.vue +++ b/src/components/common/VnLog.vue @@ -168,17 +168,17 @@ function getLogTree(data) { let originLog = null; let userLog = null; let modelLog = null; - let prevLog; let nLogs; - data.forEach((log) => { + for (let i = 0; i < data.length; i++) { + let log = data[i]; + let prevLog = i > 0 ? data[i - 1] : null; const locale = validations[log.changedModel]?.locale || {}; // Origin const originChanged = !prevLog || log.originFk != prevLog.originFk; if (originChanged) { logs.push((originLog = { originFk: log.originFk, logs: [] })); - prevLog = log; } // User const userChanged = originChanged || log.userFk != prevLog.userFk; @@ -197,6 +197,7 @@ function getLogTree(data) { log.changedModel != prevLog.changedModel || log.changedModelId != prevLog.changedModelId || nLogs >= 6; + if (modelChanged) { userLog.logs.push( (modelLog = { @@ -221,7 +222,7 @@ function getLogTree(data) { propNames = [...new Set(propNames)]; log.props = parseProps(propNames, locale, vals, olds); - }); + } return logs; }