diff --git a/package-lock.json b/package-lock.json index 680c0999c16e1a45eb4d418825663f989552cbf8..11ea8836ef80c7d858fd1be4f93fc5cfefac1da5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "fr.irstea.cassiopee", - "version": "4.4.2", + "version": "4.5.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -823,7 +823,6 @@ "version": "7.5.5", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", - "dev": true, "requires": { "@babel/highlight": "^7.0.0" } @@ -1123,7 +1122,6 @@ "version": "7.5.0", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", - "dev": true, "requires": { "chalk": "^2.0.0", "esutils": "^2.0.2", @@ -7277,8 +7275,7 @@ "electron-to-chromium": { "version": "1.3.252", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.252.tgz", - "integrity": "sha512-NWJ5TztDnjExFISZHFwpoJjMbLUifsNBnx7u2JI0gCw6SbKyQYYWWtBHasO/jPtHym69F4EZuTpRNGN11MT/jg==", - "dev": true + "integrity": "sha512-NWJ5TztDnjExFISZHFwpoJjMbLUifsNBnx7u2JI0gCw6SbKyQYYWWtBHasO/jPtHym69F4EZuTpRNGN11MT/jg==" }, "elementtree": { "version": "0.1.7", @@ -12297,7 +12294,6 @@ "version": "1.1.29", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.29.tgz", "integrity": "sha512-R5bDhzh6I+tpi/9i2hrrvGJ3yKPYzlVOORDkXhnZuwi5D3q1I5w4vYy24PJXTcLk9Q0kws9TO77T75bcK8/ysQ==", - "dev": true, "requires": { "semver": "^5.3.0" } @@ -12768,7 +12764,6 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", - "dev": true, "requires": { "p-try": "^2.0.0" } @@ -12993,15 +12988,6 @@ "safe-buffer": "^5.1.1" } }, - "parse-color": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-color/-/parse-color-1.0.0.tgz", - "integrity": "sha1-e3SLlag/A/FqlPU15S1/PZRlhhk=", - "dev": true, - "requires": { - "color-convert": "~0.5.0" - } - }, "parse-entities": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", @@ -16155,7 +16141,6 @@ "version": "4.2.1", "resolved": "https://registry.npmjs.org/terser/-/terser-4.2.1.tgz", "integrity": "sha512-cGbc5utAcX4a9+2GGVX4DsenG6v0x3glnDi5hx8816X1McEAwPlPgRtXPJzSBsbpILxZ8MQMT0KvArLuE0HP5A==", - "dev": true, "requires": { "commander": "^2.20.0", "source-map": "~0.6.1", @@ -16171,7 +16156,6 @@ "version": "0.5.13", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", - "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -17835,7 +17819,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, "requires": { "number-is-nan": "^1.0.0" } @@ -17844,7 +17827,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 98705daca673a518d7f0320dc14a7d2ca8128f49..06a76e4afbd9096415dd06fa1275006657ef67fe 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -389,6 +389,11 @@ export class AppComponent implements OnInit, OnDestroy, Observer { this.formulaireService.downloadTextFile(session, filename); } + /** + * Builds a session file including Nubs, GUI-specific Nubs metadata, + * model settings, GUI settings + * @param calcList Nubs to save + */ private buildSessionFile(calcList: any[]): string { const serialiseOptions: { [key: string]: {} } = {}; for (const c of calcList) { @@ -398,7 +403,12 @@ export class AppComponent implements OnInit, OnDestroy, Observer { }; } } - return Session.getInstance().serialise(serialiseOptions); + const settings = { + precision: this.appSetupService.computePrecision, + maxIterations: this.appSetupService.maxIterations, + displayPrecision: this.appSetupService.displayPrecision, + }; + return Session.getInstance().serialise(serialiseOptions, settings); } /** diff --git a/src/app/calculators/cond_distri/cond_distri.en.json b/src/app/calculators/cond_distri/cond_distri.en.json index 372fff647c2cf4372aef6d6fcd9e55fd35d9a506..8afedf6b768381f06a7413eb28e3b691268938ab 100644 --- a/src/app/calculators/cond_distri/cond_distri.en.json +++ b/src/app/calculators/cond_distri/cond_distri.en.json @@ -5,6 +5,5 @@ "J": "Head drop", "Lg": "Pipe length", "Nu": "Dynamic (shear) viscosity", - "fs_param_calc": "Calculation parameters", - "Pr": "Display accuracy" + "fs_param_calc": "Calculation parameters" } \ No newline at end of file diff --git a/src/app/calculators/lechapt-calmon/lechapt-calmon.en.json b/src/app/calculators/lechapt-calmon/lechapt-calmon.en.json index 8a22b96b9ad4e7f81f85786843ac91d85390699b..1d9ee60248759d6235c827ccaabe84452a08ae33 100644 --- a/src/app/calculators/lechapt-calmon/lechapt-calmon.en.json +++ b/src/app/calculators/lechapt-calmon/lechapt-calmon.en.json @@ -19,6 +19,5 @@ "D": "Pipe diameter", "J": "Head drop", "Lg": "Pipe length", - "fs_param_calc": "Calculation parameters", - "Pr": "Display accuracy" + "fs_param_calc": "Calculation parameters" } \ No newline at end of file diff --git a/src/app/calculators/lechapt-calmon/lechapt-calmon.fr.json b/src/app/calculators/lechapt-calmon/lechapt-calmon.fr.json index 4455f5680c386f07a28138217f11eff49cc65ff3..dbdb0e4dce1ada783603a6c5a71aaa27e1f7b1cd 100644 --- a/src/app/calculators/lechapt-calmon/lechapt-calmon.fr.json +++ b/src/app/calculators/lechapt-calmon/lechapt-calmon.fr.json @@ -18,6 +18,5 @@ "D": "Diamètre du tuyau", "J": "Perte de charge", "Lg": "Longueur du tuyau", - "fs_param_calc": "Paramètres de calcul", - "Pr": "Précision de calcul" + "fs_param_calc": "Paramètres de calcul" } \ No newline at end of file diff --git a/src/app/calculators/remous/remous.config.json b/src/app/calculators/remous/remous.config.json index a6110791b37fdf4b95b76ba4b44693c5e2827918..7651d9491b714c67c55ad11a39d1cc3616cda27b 100644 --- a/src/app/calculators/remous/remous.config.json +++ b/src/app/calculators/remous/remous.config.json @@ -39,7 +39,6 @@ "type": "fieldset", "fields": [ "Dx", - "Pr", { "id": "select_resolution", "type": "select", diff --git a/src/app/calculators/remous/remous.en.json b/src/app/calculators/remous/remous.en.json index 15b6decaba895b524fd78181eeccbdca7c95a70b..8218e8109773271baa9c87d2a3cfc2938e45feb1 100644 --- a/src/app/calculators/remous/remous.en.json +++ b/src/app/calculators/remous/remous.en.json @@ -23,7 +23,6 @@ "Yamont": "Water level imposed at upstream", "fs_param_calc": "Calculation parameters", "Dx": "Discretisation step", - "Pr": "Display accuracy", "select_resolution": "Resolution method", "select_resolution_Trapezes": "Integration by trapezoid", diff --git a/src/app/calculators/remous/remous.fr.json b/src/app/calculators/remous/remous.fr.json index 25110976b18ed9678f1501c77efec6c52676a115..f38893d027db578c4690ac75b2686f04045cc64d 100644 --- a/src/app/calculators/remous/remous.fr.json +++ b/src/app/calculators/remous/remous.fr.json @@ -22,7 +22,6 @@ "Yaval": "Tirant d'eau imposé à l'aval", "Yamont": "Tirant d'eau imposé à l'amont", "Dx": "Pas de discrétisation", - "Pr": "Précision de calcul des cotes", "select_resolution": "Méthode de résolution", "select_resolution_Trapezes": "Intégration par trapèzes", diff --git a/src/app/calculators/section-param/section-param.en.json b/src/app/calculators/section-param/section-param.en.json index 239f8e0f5e42c7556c2cf80c591b3aff1ebf14d9..da77bfab828897c2b9fcb171757788a5c0a81758 100644 --- a/src/app/calculators/section-param/section-param.en.json +++ b/src/app/calculators/section-param/section-param.en.json @@ -20,7 +20,6 @@ "Q": "Flow", "Y": "Draft", "fs_param_calc": "Calculation parameters", - "Pr": "Display accuracy", "Hs": "Charge spécifique", "Hsc": "Charge critique", "B": "Largeur au miroir", diff --git a/src/app/calculators/section-param/section-param.fr.json b/src/app/calculators/section-param/section-param.fr.json index 07532c3de73837d543aabef0cdfccdbbe12264c0..0de692fe988338066dfee455ce09a56a4eb77528 100644 --- a/src/app/calculators/section-param/section-param.fr.json +++ b/src/app/calculators/section-param/section-param.fr.json @@ -19,7 +19,6 @@ "fs_hydraulique": "Caractéristiques hydrauliques", "Y": "Tirant d'eau", "fs_param_calc": "Paramètres de calcul", - "Pr": "Précision de calcul", "Hs": "Charge spécifique", "Hsc": "Charge critique", "B": "Largeur au miroir", diff --git a/src/app/components/app-setup/app-setup.component.ts b/src/app/components/app-setup/app-setup.component.ts index bb782367449a17284c3a8881262de54efb53016e..95123bc93225ee25b2c3de9623b37c1dda7c5b9e 100644 --- a/src/app/components/app-setup/app-setup.component.ts +++ b/src/app/components/app-setup/app-setup.component.ts @@ -134,7 +134,7 @@ export class ApplicationSetupComponent implements Observer, OnInit { this.computePrec.addObserver(this); // modèle du composant BaseParamInputComponent du max d'itérations pour Newton - this.newtonMaxIter = new NgBaseParam("nmi", ParamDomainValue.POS, this.appSetupService.newtonMaxIterations); + this.newtonMaxIter = new NgBaseParam("nmi", ParamDomainValue.POS, this.appSetupService.maxIterations); this.newtonMaxIter.addObserver(this); // notifications @@ -160,7 +160,7 @@ export class ApplicationSetupComponent implements Observer, OnInit { break; case "nmi": - this.appSetupService.newtonMaxIterations = +data; + this.appSetupService.maxIterations = +data; break; } } 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 07943130e738a3f2872b417ce9f3f10ed3f1a25c..e53e7fd5d36a51726e0bf1cbd0bd6baeb64e480a 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 @@ -28,7 +28,7 @@ export class DialogGeneratePABComponent { private appSetupService: ApplicationSetupService, @Inject(MAT_DIALOG_DATA) public data: any ) { - const nDigits = this.appSetupService.displayDigits; + const nDigits = this.appSetupService.displayPrecision; this.coteAmont = round(data.coteAmont, nDigits); this.debit = round(data.debit, nDigits); this.chute = round(data.chute, nDigits); diff --git a/src/app/components/fixedvar-results/results.component.ts b/src/app/components/fixedvar-results/results.component.ts index 1fae7bd065c9607d14d8e6dac77b6d438f2fa219..d5282b1b15c54e4225068332b8adb43ca6e839d3 100644 --- a/src/app/components/fixedvar-results/results.component.ts +++ b/src/app/components/fixedvar-results/results.component.ts @@ -88,7 +88,7 @@ export class ResultsComponent { } else if (typeof p === "number") { originalValue = p; } - const nDigits = ServiceFactory.instance.applicationSetupService.displayDigits; + const nDigits = ServiceFactory.instance.applicationSetupService.displayPrecision; const minRenderableNumber = Number("1E-" + nDigits); // if required precision is too low, avoid rendering only zeroes if (originalValue < minRenderableNumber) { diff --git a/src/app/components/log-entry/log-entry.component.ts b/src/app/components/log-entry/log-entry.component.ts index 923c0c195934c24a3c0bfde84e14589e0748da32..5cdb305db72fb188e14a511c0608d17bdb16657e 100644 --- a/src/app/components/log-entry/log-entry.component.ts +++ b/src/app/components/log-entry/log-entry.component.ts @@ -35,7 +35,7 @@ export class LogEntryComponent implements OnChanges { } private updateText() { - const nDigits = this.appSetupService.displayDigits; + const nDigits = this.appSetupService.displayPrecision; this._text = this.intlService.localizeMessage(this._message, nDigits); } diff --git a/src/app/components/macrorugo-compound-results/macrorugo-compound-results-table.component.ts b/src/app/components/macrorugo-compound-results/macrorugo-compound-results-table.component.ts index def97e912338bcb25ef61d59cfbb5f18b4ecaec5..47158dc9a9c4a11e30bdcf69aa2fd1577a215d40 100644 --- a/src/app/components/macrorugo-compound-results/macrorugo-compound-results-table.component.ts +++ b/src/app/components/macrorugo-compound-results/macrorugo-compound-results-table.component.ts @@ -48,7 +48,7 @@ export class MacrorugoCompoundResultsTableComponent extends ResultsComponent { && ! this._mrcResults.hasOnlyErrors() ) { const pr = this._mrcResults; - const nDigits = this.appSetupService.displayDigits; + const nDigits = this.appSetupService.displayPrecision; // when a parameter is variating, index of the variating parameter // values to build the data from const vi = pr.variableIndex; diff --git a/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.ts b/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.ts index a97668c9b8bd0341820ddddd4bdefcff68ff116c..042da7ba5aba706aa328566e26ecd0b7c3266f01 100644 --- a/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.ts +++ b/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.ts @@ -283,7 +283,7 @@ export class MacrorugoCompoundResultsComponent implements DoCheck { } public formattedValue(p: NgParameter): string { - const nDigits = this.appSetupService.displayDigits; + const nDigits = this.appSetupService.displayPrecision; return p.getValue().toFixed(nDigits); } diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index 3bff2bb05783feb38e68bda76038cd858d0e4565..f867c9c205282b336cc35c52eb4d5c448ac6c1fa 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -437,7 +437,7 @@ export class PabTableComponent implements AfterViewInit, OnInit { const maxNbDevices = this.findMaxNumberOfDevices(); // adjuste precision once before anything else - const nDigits = this.appSetupService.displayDigits; + const nDigits = this.appSetupService.displayPrecision; for (const c of this.model.children) { for (const p of c.parameterIterator) { if (p.visible) { @@ -1304,7 +1304,7 @@ export class PabTableComponent implements AfterViewInit, OnInit { case "interpolate": if (result.variableDetails.occurrences > 1) { - const nDigits = this.appSetupService.displayDigits; + const nDigits = this.appSetupService.displayPrecision; const interpolatedValues: number[] = []; const variableRange = result.variableDetails.last - result.variableDetails.first; let totalBasinsLengths = 0; diff --git a/src/app/config.json b/src/app/config.json index a494eee07554b1d82588ebd51843a2c350ef0cb0..c2ec2a974ab5fd1f39b32fbfee0e7cde04f6bf2a 100644 --- a/src/app/config.json +++ b/src/app/config.json @@ -1,8 +1,8 @@ { "params": { "displayPrecision": 3, - "computePrecision": 0.0001, - "newtonMaxIterations": 50, + "computePrecision": 0.0000001, + "maxIterations": 100, "enableNotifications": true, "enableHotkeys": false, "language": "fr" diff --git a/src/app/formulaire/definition/form-compute-section-parametree.ts b/src/app/formulaire/definition/form-compute-section-parametree.ts index a1380b6588b7852a912e471b31d0d375cc4aaa39..0a47bd11f781257ea477756b926edea37e12ef65 100644 --- a/src/app/formulaire/definition/form-compute-section-parametree.ts +++ b/src/app/formulaire/definition/form-compute-section-parametree.ts @@ -49,7 +49,7 @@ export class FormComputeSectionParametree extends FormCompute { // résultats de section (avec le graphique de section) this._sectionResults.result = sectNub.result; // résultats complémentaires des paramètres fixés - this._formSectionResult.addSectionFixedParameters(false); + this._formSectionResult.addSectionFixedParameters(); this._formSectionResult.fixedResults.result = sectNub.result; } diff --git a/src/app/formulaire/definition/form-result-fixedvar.ts b/src/app/formulaire/definition/form-result-fixedvar.ts index 6a79f021e26433b02b7aefc1ab3585a29ba4e243..dbc56f6c29871bb28bad8325e82858b9f57f651e 100644 --- a/src/app/formulaire/definition/form-result-fixedvar.ts +++ b/src/app/formulaire/definition/form-result-fixedvar.ts @@ -37,9 +37,7 @@ export class FormResultFixedVar extends FormResult { public addFixedParameters() { for (const p of this._formBase.getDisplayedParamListFromState(ParamRadioConfig.FIX)) { - if (p.symbol !== "Pr") { - this._fixedResults.addFixedParameter(p); - } + this._fixedResults.addFixedParameter(p); } for (const p of this._formBase.getDisplayedParamListFromState(ParamRadioConfig.LINK)) { diff --git a/src/app/formulaire/definition/form-result-section.ts b/src/app/formulaire/definition/form-result-section.ts index 836a95edfb01e6e8af8e40c2d21508dbe2643162..73d5f0e87604939c0350a692c53389ae69c9d0f0 100644 --- a/src/app/formulaire/definition/form-result-section.ts +++ b/src/app/formulaire/definition/form-result-section.ts @@ -46,11 +46,9 @@ export class FormResultSection extends FormResult { this._sectionResults.reset(); } - public addSectionFixedParameters(displaySymbol: boolean) { + public addSectionFixedParameters() { for (const p of this._formBase.getDisplayedParamListFromState(ParamRadioConfig.FIX)) { - if (p.symbol !== "Pr") { - this._fixedResults.addFixedParameter(p); - } + this._fixedResults.addFixedParameter(p); } } diff --git a/src/app/services/app-setup.service.ts b/src/app/services/app-setup.service.ts index e2c519d44a2310cca21b97767df9df2262eb66a8..fe7a624da10b34a7c58072012ef9131581a1de9b 100644 --- a/src/app/services/app-setup.service.ts +++ b/src/app/services/app-setup.service.ts @@ -1,6 +1,9 @@ -import { HttpService } from "./http.service"; import { Injectable, Inject } from "@angular/core"; -import { Observable } from "jalhyd"; + +import { HttpService } from "./http.service"; + +import { Observable, SessionSettings } from "jalhyd"; + import { StorageService, LOCAL_STORAGE } from "ngx-webstorage-service"; /** @@ -17,11 +20,31 @@ export class ApplicationSetupService extends Observable { // default builtin values public displayPrecision = 3; - public computePrecision = 0.0001; - public newtonMaxIterations = 50; + private _computePrecision = 1e-7; // tied to model + private _maxIterations = 100; // tied to model public enableNotifications = true; public enableHotkeys = false; + public set computePrecision(p: number) { + this._computePrecision = p; + // forward to model + SessionSettings.precision = p; + } + + public get computePrecision(): number { + return this._computePrecision; + } + + public set maxIterations(m: number) { + this._maxIterations = m; + // forward to model + SessionSettings.maxIterations = m; + } + + public get maxIterations(): number { + return this._maxIterations; + } + /** * just stores the current language preference, does not transmit it to I18nService, that is * not available here. @@ -70,10 +93,6 @@ export class ApplicationSetupService extends Observable { }); } - public get displayDigits() { - return this.displayPrecision; - } - public get fallbackLanguage() { return this._fallbackLanguage; } @@ -84,7 +103,7 @@ export class ApplicationSetupService extends Observable { public saveValuesIntoLocalStorage() { this.storage.set(this.LOCAL_STORAGE_PREFIX + "displayPrecision", this.displayPrecision); this.storage.set(this.LOCAL_STORAGE_PREFIX + "computePrecision", this.computePrecision); - this.storage.set(this.LOCAL_STORAGE_PREFIX + "newtonMaxIterations", this.newtonMaxIterations); + this.storage.set(this.LOCAL_STORAGE_PREFIX + "maxIterations", this.maxIterations); this.storage.set(this.LOCAL_STORAGE_PREFIX + "enableNotifications", this.enableNotifications); this.storage.set(this.LOCAL_STORAGE_PREFIX + "enableHotkeys", this.enableHotkeys); this.storage.set(this.LOCAL_STORAGE_PREFIX + "language", this.language); @@ -119,10 +138,10 @@ export class ApplicationSetupService extends Observable { this.computePrecision = computePrecision; loadedKeys.push("computePrecision"); } - const newtonMaxIterations = this.storage.get(this.LOCAL_STORAGE_PREFIX + "newtonMaxIterations"); - if (newtonMaxIterations !== undefined) { - this.newtonMaxIterations = newtonMaxIterations; - loadedKeys.push("newtonMaxIterations"); + const maxIterations = this.storage.get(this.LOCAL_STORAGE_PREFIX + "maxIterations"); + if (maxIterations !== undefined) { + this.maxIterations = maxIterations; + loadedKeys.push("maxIterations"); } const enableNotifications = this.storage.get(this.LOCAL_STORAGE_PREFIX + "enableNotifications"); if (enableNotifications !== undefined) { @@ -150,7 +169,7 @@ export class ApplicationSetupService extends Observable { // get all config values (volontarily non-generic to prevent side-effects) this.displayPrecision = data.params.displayPrecision; this.computePrecision = data.params.computePrecision; - this.newtonMaxIterations = data.params.newtonMaxIterations; + this.maxIterations = data.params.maxIterations; this.enableNotifications = data.params.enableNotifications; this.enableHotkeys = data.params.enableHotkeys; this.language = data.params.language; diff --git a/src/app/services/formulaire.service.ts b/src/app/services/formulaire.service.ts index b331c49466a006f19c7d707f0964ae2e4c978b86..d880cb7d369c2fad3b556107309af2dda66ff241 100644 --- a/src/app/services/formulaire.service.ts +++ b/src/app/services/formulaire.service.ts @@ -594,6 +594,20 @@ export class FormulaireService extends Observable { await this.loadLocalisation(nn.nub.calcType); await this.createFormulaire(nn.nub.calcType, nn.nub, title); // await guarantees loading order } + // apply settings + if (res.settings) { + // model based settings + if (res.settings.precision !== undefined) { + this.appSetupService.computePrecision = res.settings.precision; + } + if (res.settings.maxIterations !== undefined) { + this.appSetupService.maxIterations = res.settings.maxIterations; + } + // GUI settings + if (res.settings.displayPrecision !== undefined) { + this.appSetupService.displayPrecision = res.settings.displayPrecision; + } + } // forward errors return { hasErrors: res.hasErrors, diff --git a/src/app/util.ts b/src/app/util.ts index 9fe14833bac1b92ccaaabe4faa21ea09d74281d9..6d6a10bb17488544685d8517037e8b4896274ae3 100644 --- a/src/app/util.ts +++ b/src/app/util.ts @@ -26,7 +26,7 @@ export function fv(p: NgParameter | number): string { } else if (typeof p === "number") { value = p; } - const nDigits = ServiceFactory.instance.applicationSetupService.displayDigits; + const nDigits = ServiceFactory.instance.applicationSetupService.displayPrecision; return formattedValue(value, nDigits); }