From c93e508e903ba0df70559e774138d501ae1e085f Mon Sep 17 00:00:00 2001 From: "francois.grand" <francois.grand@irstea.fr> Date: Tue, 17 Apr 2018 10:39:23 +0200 Subject: [PATCH] #77 correction d'un bug d'affichage du journal de calcul - ajout de la traduction pour le code ERROR_DICHO_CONVERGE --- .../fixedvar-results.component.ts | 22 ++++++++++++++----- src/app/results/param-calc-results.ts | 6 +++++ src/locale/error_messages.en.json | 3 ++- src/locale/error_messages.fr.json | 1 + 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/app/components/fixedvar-results/fixedvar-results.component.ts b/src/app/components/fixedvar-results/fixedvar-results.component.ts index 68e5c7f4b..790850906 100644 --- a/src/app/components/fixedvar-results/fixedvar-results.component.ts +++ b/src/app/components/fixedvar-results/fixedvar-results.component.ts @@ -95,9 +95,9 @@ export class FixedVarResultsComponent implements DoCheck { this._doUpdate = false; if (this._fixedResults != undefined) - this._doUpdate = this._fixedResults.hasResults; + this._doUpdate = this._fixedResults.hasResults || this._fixedResults.hasLog; if (this._varResults != undefined) - this._doUpdate = this._doUpdate || this._varResults.hasResults; + this._doUpdate = this._doUpdate || this._varResults.hasResults || this._varResults.hasLog; } public ngDoCheck() { @@ -105,12 +105,22 @@ export class FixedVarResultsComponent implements DoCheck { this._doUpdate = !this.updateResults(); } + private mergeLog(result: Result, log: cLog) { + if (result && result.hasLog) { + if (result.hasGlobalLog) + log.addLog(result.globalLog); + else + log.addLog(result.log); + } + } + private get mergedGlobalLogs(): cLog { const res = new cLog(); - if (this._fixedResults && this._fixedResults.log) - res.addLog(this._fixedResults.log); - if (this._varResults && this._varResults.log) - res.addLog(this._varResults.log); + if (this._fixedResults) + this.mergeLog(this._fixedResults.result, res); + + if (this._varResults) + this.mergeLog(this._varResults.result, res); return res; } diff --git a/src/app/results/param-calc-results.ts b/src/app/results/param-calc-results.ts index 2e9802f80..4a24add19 100644 --- a/src/app/results/param-calc-results.ts +++ b/src/app/results/param-calc-results.ts @@ -44,6 +44,12 @@ export abstract class CalculatedParamResults extends CalculatorResults { return this._result.ok; } + public get hasLog(): boolean { + if (this._result == undefined) + return false; + return this._result.hasLog; + } + public get log(): cLog { return this._result && this._result.log; // return x == undefined ? undefined : x.y } diff --git a/src/locale/error_messages.en.json b/src/locale/error_messages.en.json index 2711bac57..86f94a508 100644 --- a/src/locale/error_messages.en.json +++ b/src/locale/error_messages.en.json @@ -5,6 +5,7 @@ "ERROR_DICHO_NULL_STEP": "Dichotomy (initial interval search): invalid null step", "ERROR_DICHO_INVALID_STEP_GROWTH": "Dichotomy (initial interval search): invalid null step growth", "ERROR_DICHO_FUNCTION_VARIATION": "unable to determinate function direction of variation", + "ERROR_DICHO_CONVERGE": "Dichotomy could not converge", "ERROR_NEWTON_DERIVEE_NULLE": "Null function derivative in Newton computation", "ERROR_PARAMDOMAIN_INTERVAL_BOUNDS": "invalid %minValue%/%maxValue% min/max boundaries for 'interval' parameter definition domain", "ERROR_PARAMDEF_CALC_UNDEFINED": "calculability of '%symbol%' parameter is undefined", @@ -81,4 +82,4 @@ "INFO_PABDIM_TITRE": "Pool pass: dimensions", "INFO_PABPUISS_TITRE": "Pool pass: dissipated power", "INFO_OUVRAGEPARAL_TITRE": "Parallel structures" -} +} \ No newline at end of file diff --git a/src/locale/error_messages.fr.json b/src/locale/error_messages.fr.json index d08817f01..f336ee9cf 100644 --- a/src/locale/error_messages.fr.json +++ b/src/locale/error_messages.fr.json @@ -5,6 +5,7 @@ "ERROR_DICHO_NULL_STEP": "Dichotomie : le pas pour la recherche de l'intervalle de départ ne devrait pas être nul", "ERROR_DICHO_INVALID_STEP_GROWTH": "Dichotomie : l'augmentation du pas pour la recherche de l'intervalle de départ est incorrecte (=0)", "ERROR_DICHO_FUNCTION_VARIATION": "Dichotomie : impossible de determiner le sens de variation de la fonction", + "ERROR_DICHO_CONVERGE": "La dichotomie n'a pas pu converger", "ERROR_NEWTON_DERIVEE_NULLE": "Dérivée nulle dans un calcul par la méthode de Newton", "ERROR_PARAMDOMAIN_INTERVAL_BOUNDS": "Les bornes (%minValue%/%maxValue%) de l'intervalle sont incorrectes", "ERROR_PARAMDEF_CALC_UNDEFINED": "La calculabilité du paramètre %symbol% n'est pas définie", -- GitLab