From 7f7c3727d5ff1f58e6331b4dd6bb8c73d76b0f65 Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Mon, 18 Nov 2019 17:37:27 +0100 Subject: [PATCH] Update results logs for SPP --- src/app/results/var-results.ts | 48 ++++++++++++++++++++-------------- src/locale/messages.en.json | 2 +- src/locale/messages.fr.json | 2 +- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/app/results/var-results.ts b/src/app/results/var-results.ts index 168dd2393..48038a9c6 100644 --- a/src/app/results/var-results.ts +++ b/src/app/results/var-results.ts @@ -214,13 +214,15 @@ export class VarResults extends CalculatedParamResults implements PlottableData } } // children results - const sn = this.result.sourceNub; - for (const c of sn.getChildren()) { - if (c.result) { - // using latest ResultElement; results count / types are supposed to be the same on every iteration - for (const k of c.result.resultElement.keys) { - if (k.indexOf("ENUM_") === -1) { // ENUM variables are not plottable - res.push(c.findPositionInParent() + "_" + k); + if (this.result) { + const sn = this.result.sourceNub; + for (const c of sn.getChildren()) { + if (c.result) { + // using latest ResultElement; results count / types are supposed to be the same on every iteration + for (const k of c.result.resultElement.keys) { + if (k.indexOf("ENUM_") === -1) { // ENUM variables are not plottable + res.push(c.findPositionInParent() + "_" + k); + } } } } @@ -277,19 +279,21 @@ export class VarResults extends CalculatedParamResults implements PlottableData } } // children results - const sn = this.result.sourceNub; - for (const c of sn.getChildren()) { - if (c.result) { - for (const k of c.result.resultElement.keys) { - const fam = this.result.sourceNub.getFamily(k); - // exclude pseudo-family "ANY" - if (fam !== undefined && fam !== ParamFamily.ANY) { - const f = ParamFamily[fam]; - if (! (f in families)) { - families[f] = []; + if (this.result) { + const sn = this.result.sourceNub; + for (const c of sn.getChildren()) { + if (c.result) { + for (const k of c.result.resultElement.keys) { + const fam = this.result.sourceNub.getFamily(k); + // exclude pseudo-family "ANY" + if (fam !== undefined && fam !== ParamFamily.ANY) { + const f = ParamFamily[fam]; + if (! (f in families)) { + families[f] = []; + } + const pos = c.findPositionInParent(); + families[f].push(pos + "_" + k); } - const pos = c.findPositionInParent(); - families[f].push(pos + "_" + k); } } } @@ -302,7 +306,11 @@ export class VarResults extends CalculatedParamResults implements PlottableData * (used by tooltip functions) */ public getVariatingParametersSymbols(): string[] { - return this._variatedParams.map(vp => this.getVariatingParameterSymbol(vp, this.result.sourceNub)); + if (this.result && this.result.sourceNub) { + return this._variatedParams.map(vp => this.getVariatingParameterSymbol(vp, this.result.sourceNub)); + } else { + return []; + } } public getVariatingParameterSymbol(vp: NgParameter, sourceNub: Nub): string { diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index 099d3bc74..cff254e1e 100644 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -59,7 +59,7 @@ "ERROR_SECTION_NON_CONVERGENCE_NEWTON_HNORMALE": "Non convergence of the calculation of the normal depth (Newton's method)", "ERROR_SECTION_PENTE_NEG_NULLE_HNORMALE_INF": "The slope is negative or zero, the normal depth is infinite", "ERROR_SECTION_SURFACE_NULLE": "Section: calculation is impossible when surface is null", - "ERROR_SOMETHING_FAILED": "Some calculation step has failed", + "ERROR_SOMETHING_FAILED_IN_CHILD": "Calculation of child module #%number% failed", "ERROR_STRUCTURE_Q_TROP_ELEVE": "The flow passing through the other devices is too high: the requested parameter is not calculable.", "INFO_CALCULATOR_CALC_NAME": "Calculator name", "INFO_CALCULATOR_CALCULER": "Compute", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index a21716195..808e3ae54 100644 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -59,7 +59,7 @@ "ERROR_SECTION_NON_CONVERGENCE_NEWTON_HNORMALE": "Non convergence du calcul de la hauteur normale (Méthode de Newton)", "ERROR_SECTION_PENTE_NEG_NULLE_HNORMALE_INF": "La pente est négative ou nulle, la hauteur normale est infinie", "ERROR_SECTION_SURFACE_NULLE": "Section : calcul impossible à cause d'une surface nulle", - "ERROR_SOMETHING_FAILED": "Une étape du calcul a échoué", + "ERROR_SOMETHING_FAILED_IN_CHILD": "Le calcul du module enfant n°%number% a échoué", "ERROR_STRUCTURE_Q_TROP_ELEVE": "Le débit passant par les autres ouvrages est trop élevé: le paramètre demandé n'est pas calculable.", "INFO_CALCULATOR_CALC_NAME": "Nom du module de calcul", "INFO_CALCULATOR_CALCULER": "Calculer", -- GitLab