diff --git a/lib/DataHarmonizer.js b/lib/DataHarmonizer.js index 6023a237..ffc4c389 100644 --- a/lib/DataHarmonizer.js +++ b/lib/DataHarmonizer.js @@ -778,8 +778,9 @@ class DataHarmonizer { // Validate and process the current selection const is1mAndHasParent = (class_assignment) => { - console.log(this.context.currentSelection, this.context.oneToManyAppContext.appContext[class_assignment]); - const unique_keys = this.context.oneToManyAppContext.appContext[class_assignment].unique_keys; + const unique_keys = + this.context.oneToManyAppContext.appContext[class_assignment] + .unique_keys; for (let key in unique_keys) { if ('foreign_key' in unique_keys[key]) { return unique_keys[key].foreign_key; @@ -787,11 +788,18 @@ class DataHarmonizer { } return false; }; - const classIsForeignKeyForClassAndCurrentSelection = (maybe_child_class, currentSelection) => { - const unique_keys = this.context.oneToManyAppContext.appContext[maybe_child_class].unique_keys; - return !isEmptyUnitVal(unique_keys[currentSelection.shared_key_name]) && maybe_child_class !== currentSelection.source; - - } + const classIsForeignKeyForClassAndCurrentSelection = ( + maybe_child_class, + currentSelection + ) => { + const unique_keys = + this.context.oneToManyAppContext.appContext[maybe_child_class] + .unique_keys; + return ( + !isEmptyUnitVal(unique_keys[currentSelection.shared_key_name]) && + maybe_child_class !== currentSelection.source + ); + }; // check if the DH refers to a parent class or class with no children. // if it has a parent, ensure a foreign key is selected in some parent // if it doesn't have a parent, use regular add rows implementation @@ -799,9 +807,11 @@ class DataHarmonizer { if ( !isEmptyUnitVal(this.context.currentSelection) && !isEmptyUnitVal(this.context.currentSelection.valueToMatch) && - classIsForeignKeyForClassAndCurrentSelection(this.class_assignment, this.context.currentSelection) + classIsForeignKeyForClassAndCurrentSelection( + this.class_assignment, + this.context.currentSelection + ) ) { - // Insert the new rows below the last existing row this.hot.alter('insert_row_below', startRowIndex, numRows); // Find the nearest index after the last non-empty row in the specified column diff --git a/lib/Toolbar.js b/lib/Toolbar.js index 7f16b1b6..b69031f2 100644 --- a/lib/Toolbar.js +++ b/lib/Toolbar.js @@ -35,7 +35,6 @@ import pkg from '../package.json'; const VERSION = pkg.version; - class Toolbar { constructor(root, context, options = {}) { this.context = context;