diff --git a/src/app/components/dialog-generate-pab/dialog-generate-pab.component.ts b/src/app/components/dialog-generate-pab/dialog-generate-pab.component.ts index 202aa1fd89632c45871623cdc91bcbece1f12737..ebbeb145099bc6f3ad7526a34324cf3b95f6a2b3 100644 --- a/src/app/components/dialog-generate-pab/dialog-generate-pab.component.ts +++ b/src/app/components/dialog-generate-pab/dialog-generate-pab.component.ts @@ -26,7 +26,7 @@ export class DialogGeneratePABComponent { private appSetupService: ApplicationSetupService, @Inject(MAT_DIALOG_DATA) public data: any ) { - const nDigits = this.appSetupService.displayPrecision; + const nDigits = 3; // nghyd#543 this.coteAmont = data.coteAmont ? round(data.coteAmont, nDigits) : undefined; this.debit = data.debit ? round(data.debit, nDigits) : undefined; this.nbBassins = data.nbBassins; diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index f22816c7dfc97d65842dede42319def5acb459a2..8ef4e14c146d960d5b7d726f0fbb1c824a1d3da1 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -77,6 +77,9 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni /** used for shift+click implementation */ private latestClickedCell: any; + /** number of digits (after decimal point) to use to display number in the table */ + private readonly nDigits = 3; // 3 -> cf. nghyd#543 + public constructor( private i18nService: I18nService, private formService: FormulaireService, @@ -460,21 +463,6 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni private refresh() { const maxNbDevices = this.findMaxNumberOfDevices(); - // adjuste precision once before anything else - const nDigits = this.appSetupService.displayPrecision; - for (const c of this.model.children) { - for (const p of c.parameterIterator) { - if (p.visible && p.symbol !== "QA") { // QA might vary ! - p.singleValue = round(p.singleValue, nDigits); - } - } - } - for (const p of this.model.downWall.parameterIterator) { - if (p.visible) { - p.singleValue = round(p.singleValue, nDigits); - } - } - // 0. build spanned headers over real columns this.headers = []; // 1 header for basin @@ -1348,7 +1336,6 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni case "interpolate": if (result.variableDetails.occurrences > 1) { - const nDigits = this.appSetupService.displayPrecision; const interpolatedValues: number[] = []; const variableRange = result.variableDetails.last - result.variableDetails.first; let totalBasinsLengths = 0; @@ -1391,7 +1378,7 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni /* console.log(`Wall ${i} : length = ${currentLength} / ${totalBasinsLengths}` + ` (${currentBasinLengthPercentage}), applying step of ${step}`); */ currentValue += step; - interpolatedValues.push(round(currentValue, nDigits)); + interpolatedValues.push(currentValue); } } else { // for other interpolable elevations, exclude last basin @@ -1403,7 +1390,7 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni /* console.log(`Wall ${i} : length = ${currentBasinLength} / ${totalBasinsLengths}` + ` (${currentBasinLengthPercentage}), applying step of ${step}`); */ currentValue += step; - interpolatedValues.push(round(currentValue, nDigits)); + interpolatedValues.push(currentValue); } } } @@ -1443,7 +1430,7 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni } public getCellValue(cell) { - return cell.model.singleValue; + return round(cell.model.singleValue, this.nDigits); } public setCellValue(cell, event) {