Revert "Calcs: Update diff percent to be a percent" (#91563)

Revert "Calcs: Update diff percent to be a percent (#90533)"

This reverts commit 5e21898294.
This commit is contained in:
Ihor Yeromin
2024-08-06 11:03:01 +03:00
committed by GitHub
parent d4916207a0
commit da291998cf
2 changed files with 2 additions and 3 deletions
@@ -55,14 +55,13 @@ describe('Stats Calculators', () => {
it('should calculate basic stats', () => { it('should calculate basic stats', () => {
const stats = reduceField({ const stats = reduceField({
field: basicTable.fields[0], field: basicTable.fields[0],
reducers: [ReducerID.first, ReducerID.last, ReducerID.mean, ReducerID.count, ReducerID.diffperc], reducers: [ReducerID.first, ReducerID.last, ReducerID.mean, ReducerID.count],
}); });
expect(stats.first).toEqual(10); expect(stats.first).toEqual(10);
expect(stats.last).toEqual(20); expect(stats.last).toEqual(20);
expect(stats.mean).toEqual(15); expect(stats.mean).toEqual(15);
expect(stats.count).toEqual(2); expect(stats.count).toEqual(2);
expect(stats.diffperc).toEqual(100);
}); });
it('should handle undefined field data without crashing', () => { it('should handle undefined field data without crashing', () => {
@@ -582,7 +582,7 @@ export function doStandardCalcs(field: Field, ignoreNulls: boolean, nullAsZero:
} }
if (isNumber(calcs.firstNotNull) && isNumber(calcs.diff)) { if (isNumber(calcs.firstNotNull) && isNumber(calcs.diff)) {
calcs.diffperc = (calcs.diff / calcs.firstNotNull) * 100; calcs.diffperc = calcs.diff / calcs.firstNotNull;
} }
return calcs; return calcs;
} }