Skip to content

Commit

Permalink
Why 5? wtf
Browse files Browse the repository at this point in the history
  • Loading branch information
kennsippell committed Dec 6, 2024
1 parent 42c6789 commit 8f2bbd6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/lib/hierarchy-operations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function moveHierarchy(db, options) {

minifyLineageAndWriteToDisk(options, [...updatedDescendants, ...updatedAncestors]);

const movedReportsCount = await moveReports(db, options, moveContext, destinationId);
const movedReportsCount = await moveReports(db, options, moveContext);
trace(`${movedReportsCount} report(s) created by these affected contact(s) will be updated`);

affectedContactCount += updatedDescendants.length + updatedAncestors.length;
Expand Down Expand Up @@ -166,16 +166,18 @@ function replaceLineageInContacts(options, moveContext) {
}
}

const result = [];
for (const doc of moveContext.descendantsAndSelf) {
function sonarQubeComplexityFiveIsTooLow(doc) {
const docIsSource = doc._id === sourceId;

// skip top-level because it will be deleted
if (options.merge && docIsSource) {
continue;
if (!options.merge || !docIsSource) {
return replaceForSingleContact(doc);
}
}

const updatedDoc = replaceForSingleContact(doc);
const result = [];
for (const doc of moveContext.descendantsAndSelf) {
const updatedDoc = sonarQubeComplexityFiveIsTooLow(doc);
if (updatedDoc) {
result.push(updatedDoc);
}
Expand Down

0 comments on commit 8f2bbd6

Please sign in to comment.