fix: refs #6630 getLogTree grouping fixed
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-01-09 15:21:26 +01:00
parent 5438ce5c33
commit 57eca9b267
1 changed files with 5 additions and 4 deletions

View File

@ -168,17 +168,17 @@ function getLogTree(data) {
let originLog = null; let originLog = null;
let userLog = null; let userLog = null;
let modelLog = null; let modelLog = null;
let prevLog;
let nLogs; 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 || {}; const locale = validations[log.changedModel]?.locale || {};
// Origin // Origin
const originChanged = !prevLog || log.originFk != prevLog.originFk; const originChanged = !prevLog || log.originFk != prevLog.originFk;
if (originChanged) { if (originChanged) {
logs.push((originLog = { originFk: log.originFk, logs: [] })); logs.push((originLog = { originFk: log.originFk, logs: [] }));
prevLog = log;
} }
// User // User
const userChanged = originChanged || log.userFk != prevLog.userFk; const userChanged = originChanged || log.userFk != prevLog.userFk;
@ -197,6 +197,7 @@ function getLogTree(data) {
log.changedModel != prevLog.changedModel || log.changedModel != prevLog.changedModel ||
log.changedModelId != prevLog.changedModelId || log.changedModelId != prevLog.changedModelId ||
nLogs >= 6; nLogs >= 6;
if (modelChanged) { if (modelChanged) {
userLog.logs.push( userLog.logs.push(
(modelLog = { (modelLog = {
@ -221,7 +222,7 @@ function getLogTree(data) {
propNames = [...new Set(propNames)]; propNames = [...new Set(propNames)];
log.props = parseProps(propNames, locale, vals, olds); log.props = parseProps(propNames, locale, vals, olds);
}); }
return logs; return logs;
} }