Skip to content

Commit 136ffee

Browse files
committed
fix to bin update not working on numeric age unit change
1 parent ec6ca47 commit 136ffee

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/DataHarmonizer.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -2435,6 +2435,12 @@ class DataHarmonizer {
24352435
*/
24362436

24372437
/**
2438+
* fieldChangeRules() is triggered when user changes a value on a cell,
2439+
* before that change is committed.
2440+
*
2441+
* IMPORTANT: Value of cell user is changing is in change[3], not in
2442+
* this.hot.getDataAtCell(row, col) - the getDataAtCell() is old value.
2443+
*
24382444
* Iterate through rules set up for named columns
24392445
* Like matrixFieldChangeRules but this is triggered by a single change
24402446
* by a user edit on a field cell. This creates complexity for fields that
@@ -2481,13 +2487,13 @@ class DataHarmonizer {
24812487
// Don't attempt to reformat x/y/z dates here.
24822488
const dateGranularity = this.hot.getDataAtCell(row, col + 1).split(' ')[0];
24832489
// previously had to block x/y/z with change[3].indexOf('/') === -1 &&
2490+
// ISSUE: not multilingual?
24842491
if (dateGranularity === 'year' || dateGranularity === 'month') {
24852492
change[3] = this.setDateChange(dateGranularity, change[3]);
24862493
}
24872494
return;
24882495
}
24892496

2490-
/* Deprecating this. Users need to change unit to trigger bin
24912497
// Match <field> [field]_unit [field]_bin
24922498
const nextNextName =
24932499
fields.length > col + 2 ? fields[col + 2].name : null;
@@ -2497,7 +2503,6 @@ class DataHarmonizer {
24972503
this.binChangeTest(matrix, col, fields, 2, triggered_changes);
24982504
return;
24992505
}
2500-
*/
25012506
}
25022507

25032508
// On [field] here, where next column is "[field]_bin".
@@ -2513,7 +2518,7 @@ class DataHarmonizer {
25132518
console.log("on", prevName + '_unit')
25142519
// trigger reevaluation of bin from field
25152520
matrixRow[col - 1] = this.hot.getDataAtCell(row, col - 1);
2516-
matrixRow[col] = this.hot.getDataAtCell(row, col);
2521+
matrixRow[col] = change[3];
25172522
this.binChangeTest(matrix, col - 1, fields, 2, triggered_changes);
25182523
return;
25192524
}

0 commit comments

Comments
 (0)