diff --git a/jalhyd_branch b/jalhyd_branch index 1f7391f92b6a3792204e07e99f71f643cc35e7e1..554b541df35b8453451cb15ae370893ed9d6d49c 100644 --- a/jalhyd_branch +++ b/jalhyd_branch @@ -1 +1 @@ -master +308-log-ameliorer-la-synthese-de-journal \ No newline at end of file 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 232f0c436caa9e177defbe862dbdb940a4f7fd39..86eba4301034bb0bc758ebed7904cf1e4ae25f11 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 @@ -10,6 +10,7 @@ import { ApplicationSetupService } from "../../services/app-setup.service"; import { I18nService } from "../../services/internationalisation.service"; import { MacrorugoCompoundResults } from "../../results/macrorugo-compound-results"; import { ResultsComponentDirective } from "../fixedvar-results/results.component"; +import { LogHelper } from "app/results/log-helper"; @Component({ selector: "macrorugo-compound-results", @@ -23,6 +24,8 @@ export class MacrorugoCompoundResultsComponent extends ResultsComponentDirective /** résultats non mis en forme */ private _mrcResults: MacrorugoCompoundResults; + private _logHelper: LogHelper; + constructor( private appSetupService: ApplicationSetupService, private i18nService: I18nService, @@ -33,143 +36,19 @@ export class MacrorugoCompoundResultsComponent extends ResultsComponentDirective @Input() public set results(rs: CalculatorResults[]) { this._mrcResults = undefined; + this._logHelper = undefined; if (rs.length > 0 && rs[0] instanceof MacrorugoCompoundResults) { this._mrcResults = rs[0] as MacrorugoCompoundResults; + this._logHelper = new LogHelper(this._mrcResults); } } - private mergeGlobalLog(result: Result, log: cLog) { - if (result) { - if (result.hasGlobalLog()) { - log.addLog(result.globalLog); - } - // if no parameter is varying, 1st element log is considered "global" - if (this.mrcResults.variatedParameters.length === 0) { - if (result.hasResultElements() && result.resultElement.hasLog()) { - log.addLog(result.log); - } - } - } - } - - /** - * Returns the number of errors, warnings, infos among children logs - */ - private logStats(): any { - const ret = { - info: 0, - warning: 0, - error: 0 - }; - if (this._mrcResults.result && this._mrcResults.result.hasLog()) { - for (const re of this._mrcResults.result.resultElements) { - if (re.hasLog()) { - for (const m of re.log.messages) { - const s = m.getSeverity(); - switch (s) { - case MessageSeverity.INFO: - ret.info ++; - break; - case MessageSeverity.WARNING: - ret.warning ++; - break; - case MessageSeverity.ERROR: - ret.error ++; - break; - } - } - } - } - } - for (const cr of this._mrcResults.childrenResults) { - if (cr && cr.hasLog()) { - for (const re of cr.resultElements) { - if (re.hasLog()) { - for (const m of re.log.messages) { - const s = m.getSeverity(); - switch (s) { - case MessageSeverity.INFO: - ret.info ++; - break; - case MessageSeverity.WARNING: - ret.warning ++; - break; - case MessageSeverity.ERROR: - ret.error ++; - break; - } - } - } - } - } - } - return ret; - } - - /* - * Retourne les logs à afficher dans le composant de log global, au dessus - * du sélecteur d'itération : messages globaux et / ou résumé des messages - * spécifiques à chaque ResultElement - */ public get globalLog(): cLog { - const l = new cLog(); - if (this._mrcResults && this.mrcResults.variatedParameters.length > 0) { - this.mergeGlobalLog(this._mrcResults.result, l); - // un problème avec la MRC en général / les cloisons, à une étape quelconque ? - if ( - (this.mrcResults.hasLog) - && l.messages.length === 0 // existing global messages make generic message below useless - ) { - const logStats = this.logStats(); - const m = new Message(MessageCode.WARNING_PROBLEMS_ENCOUNTERED); - m.extraVar.info = "" + logStats.info; // to avoid displaying fixed number of digits - m.extraVar.warning = "" + logStats.warning; - m.extraVar.error = "" + logStats.error; - l.add(m); - // l.add(new Message(MessageCode.WARNING_PROBLEMS_ENCOUNTERED)); - } - } // sinon pas de log global (aucun paramètre ne varie) - return l; + return this._logHelper.globalLog; } - /** - * Retourne les logs à afficher dans le composant de log local, en dessous - * du sélecteur d'itération : messages concernant l'itération (le ResultElement) - * en cours - */ public get iterationLog(): cLog { - const l = new cLog(); - if (this._mrcResults) { - if (this.mrcResults.variatedParameters.length > 0) { - // A. si un paramètre varie - const vi = this._mrcResults.variableIndex; - // log de la MRC pour l'itération en cours - if ( - this._mrcResults.result - && this._mrcResults.result.hasResultElements() - && this._mrcResults.result.resultElements[vi] - && this._mrcResults.result.resultElements[vi].hasLog() - ) { - l.addLog(this._mrcResults.result.resultElements[vi].log); - } - // logs des enfants pour l'itération en cours - for (const cr of this._mrcResults.childrenResults) { - if (cr && cr.hasResultElements() && cr.resultElements[vi].hasLog()) { - l.addLog(cr.resultElements[vi].log); - } - } - } else { - // B. si aucun paramètre ne varie - this.mergeGlobalLog(this._mrcResults.result, l); // faut bien mettre le log global quelque part - // logs des enfants - for (const cr of this._mrcResults.childrenResults) { - if (cr && cr.hasResultElements() && cr.resultElement.hasLog()) { - l.addLog(cr.resultElement.log); - } - } - } - } - return l; + return this._logHelper.iterationLog; } public get mrcResults() { diff --git a/src/app/components/pab-results/pab-results.component.ts b/src/app/components/pab-results/pab-results.component.ts index bb190be6a1e861fcf81ffa3a2079ef2efd85ad72..a8f7514a91b3d005c89620efe1f6830338b4dba0 100644 --- a/src/app/components/pab-results/pab-results.component.ts +++ b/src/app/components/pab-results/pab-results.component.ts @@ -1,4 +1,5 @@ import { Component, Input } from "@angular/core"; +import { LogHelper } from "app/results/log-helper"; import { Result, cLog, Message, MessageCode, MessageSeverity } from "jalhyd"; @@ -19,6 +20,8 @@ export class PabResultsComponent extends ResultsComponentDirective { /** résultats non mis en forme */ private _pabResults: PabResults; + private _logHelper: LogHelper; + constructor( private i18nService: I18nService, ) { @@ -30,167 +33,18 @@ export class PabResultsComponent extends ResultsComponentDirective { this._pabResults = undefined; if (rs.length > 0 && rs[0] instanceof PabResults) { this._pabResults = rs[0] as PabResults; - } - } - - private mergeGlobalLog(result: Result, log: cLog) { - if (result) { - if (result.hasGlobalLog()) { - log.addLog(result.globalLog); - } - // if no parameter is varying, 1st element log is considered "global" - if (this.pabResults.variatedParameters.length === 0) { - if (result.hasResultElements() && result.resultElement.hasLog()) { - log.addLog(result.log); - } - } - } - } - /** - * Returns the number of errors, warnings, infos among children logs - */ - private logStats(): any { - const ret = { - info: 0, - warning: 0, - error: 0 - }; - if (this._pabResults.result && this._pabResults.result.hasLog()) { - for (const re of this._pabResults.result.resultElements) { - if (re.hasLog()) { - for (const m of re.log.messages) { - const s = m.getSeverity(); - switch (s) { - case MessageSeverity.INFO: - ret.info ++; - break; - case MessageSeverity.WARNING: - ret.warning ++; - break; - case MessageSeverity.ERROR: - ret.error ++; - break; - } - } - } - } - } - for (const cr of this._pabResults.cloisonsResults) { - if (cr && cr.hasLog()) { - for (const re of cr.resultElements) { - if (re.hasLog()) { - for (const m of re.log.messages) { - const s = m.getSeverity(); - switch (s) { - case MessageSeverity.INFO: - ret.info ++; - break; - case MessageSeverity.WARNING: - ret.warning ++; - break; - case MessageSeverity.ERROR: - ret.error ++; - break; - } - } - } - } - } - } - if (this._pabResults.cloisonAvalResults && this._pabResults.cloisonAvalResults.hasLog()) { - for (const re of this._pabResults.cloisonAvalResults.resultElements) { - if (re.hasLog()) { - for (const m of re.log.messages) { - const s = m.getSeverity(); - switch (s) { - case MessageSeverity.INFO: - ret.info ++; - break; - case MessageSeverity.WARNING: - ret.warning ++; - break; - case MessageSeverity.ERROR: - ret.error ++; - break; - } - } - } - } + // log helper + this._logHelper = new LogHelper(this._pabResults); } - return ret; } - /* - * Retourne les logs à afficher dans le composant de log global, au dessus - * du sélecteur d'itération : messages globaux et / ou résumé des messages - * spécifiques à chaque ResultElement - */ public get globalLog(): cLog { - const l = new cLog(); - if (this._pabResults && this.pabResults.variatedParameters.length > 0) { - this.mergeGlobalLog(this._pabResults.result, l); - // un problème avec la PAB en général / les cloisons, à une étape quelconque ? - if ( - (this.pabResults.hasLog) - && l.messages.length === 0 // existing global messages make generic message below useless - ) { - const logStats = this.logStats(); - const m = new Message(MessageCode.WARNING_PROBLEMS_ENCOUNTERED); - m.extraVar.info = "" + logStats.info; // to avoid displaying fixed number of digits - m.extraVar.warning = "" + logStats.warning; - m.extraVar.error = "" + logStats.error; - l.add(m); - // l.add(new Message(MessageCode.WARNING_PROBLEMS_ENCOUNTERED)); - } - } // sinon pas de log global (aucun paramètre ne varie) - return l; + return this._logHelper.globalLog; } - /** - * Retourne les logs à afficher dans le composant de log local, en dessous - * du sélecteur d'itération : messages concernant l'itération (le ResultElement) - * en cours - */ public get iterationLog(): cLog { - const l = new cLog(); - if (this._pabResults) { - if (this.pabResults.variatedParameters.length > 0) { - // A. si un paramètre varie - const vi = this._pabResults.variableIndex; - // log de la PAB pour l'itération en cours - if ( - this._pabResults.result - && this._pabResults.result.hasResultElements() - && this._pabResults.result.resultElements[vi] - && this._pabResults.result.resultElements[vi].hasLog() - ) { - l.addLog(this._pabResults.result.resultElements[vi].log); - } - // logs des enfants pour l'itération en cours - for (const cr of this._pabResults.cloisonsResults) { - if (cr && cr.hasResultElements() && cr.resultElements[vi].hasLog()) { - l.addLog(cr.resultElements[vi].log); - } - } - if (this._pabResults.cloisonAvalResults && this._pabResults.cloisonAvalResults.resultElements[vi].hasLog()) { - l.addLog(this._pabResults.cloisonAvalResults.resultElements[vi].log); - } - } else { - // B. si aucun paramètre ne varie - this.mergeGlobalLog(this._pabResults.result, l); // faut bien mettre le log global quelque part - // logs des enfants - for (const cr of this._pabResults.cloisonsResults) { - if (cr && cr.hasResultElements() && cr.resultElement.hasLog()) { - l.addLog(cr.resultElement.log); - } - } - if (this._pabResults.cloisonAvalResults && this._pabResults.cloisonAvalResults.resultElement.hasLog()) { - l.addLog(this._pabResults.cloisonAvalResults.resultElement.log); - } - } - } - return l; + return this._logHelper.iterationLog; } public get pabResults() { diff --git a/src/app/components/pb-results/pb-results.component.ts b/src/app/components/pb-results/pb-results.component.ts index a5136f9e92a69a0480a7025c9b81495fe978a59c..91126794814d82ae52b62bf0689bf65a901d1ee5 100644 --- a/src/app/components/pb-results/pb-results.component.ts +++ b/src/app/components/pb-results/pb-results.component.ts @@ -5,6 +5,8 @@ import { PrebarrageResults } from "../../results/prebarrage-results"; import { I18nService } from "../../services/internationalisation.service"; import { cLog, Message, MessageCode, MessageSeverity, PreBarrage, Result } from "jalhyd"; +import { ServiceFactory } from "app/services/service-factory"; +import { LogHelper } from "app/results/log-helper"; @Component({ selector: "pb-results", @@ -18,6 +20,8 @@ export class PbResultsComponent { /** résultats des bassins, non mis en forme */ private _pbResults: PrebarrageResults; + private _logHelper: LogHelper; + constructor( private i18nService: I18nService, ) { } @@ -25,9 +29,12 @@ export class PbResultsComponent { @Input() public set results(rs: CalculatorResults[]) { this._pbResults = undefined; + this._logHelper = undefined; for (const r of rs) { if (r instanceof PrebarrageResults) { this._pbResults = r as PrebarrageResults; + // log helper + this._logHelper = new LogHelper(this._pbResults); } } } @@ -56,149 +63,12 @@ export class PbResultsComponent { return this._pbResults && this._pbResults.hasWallResults; } - private mergeGlobalLog(result: Result, log: cLog) { - if (result) { - if (result.hasGlobalLog()) { - log.addLog(result.globalLog); - } - // if no parameter is varying, 1st element log is considered "global" - if (this.pbResults.variatedParameters.length === 0) { - if (result.hasResultElements() && result.resultElement.hasLog()) { - log.addLog(result.log); - } - } - } - } - - /** - * Returns the number of errors, warnings, infos among children logs - */ - private logStats(): any { - const ret = { - info: 0, - warning: 0, - error: 0 - }; - if (this._pbResults.result?.hasLog()) { - for (const re of this._pbResults.result.resultElements) { - if (re.hasLog()) { - for (const m of re.log.messages) { - const s = m.getSeverity(); - switch (s) { - case MessageSeverity.INFO: - ret.info ++; - break; - case MessageSeverity.WARNING: - ret.warning ++; - break; - case MessageSeverity.ERROR: - ret.error ++; - break; - } - } - } - } - } - const pb = this._pbResults.result.sourceNub as PreBarrage; - for (const pbc of pb.children) { // bassins et cloisons - if (pbc.result !== undefined) { - for (const re of pbc.result.resultElements) { - if (re.hasLog()) { - for (const m of re.log.messages) { - const s = m.getSeverity(); - switch (s) { - case MessageSeverity.INFO: - ret.info ++; - break; - case MessageSeverity.WARNING: - ret.warning ++; - break; - case MessageSeverity.ERROR: - ret.error ++; - break; - } - } - } - } - } - } - return ret; - } - - /* - * Retourne les logs à afficher dans le composant de log global, au dessus - * du sélecteur d'itération : messages globaux et / ou résumé des messages - * spécifiques à chaque ResultElement - */ public get globalLog(): cLog { - const l = new cLog(); - /* console.log( - `>> Global Log >> this._pbResults: ${this._pbResults !== undefined}` - + `, vpl: ${this?._pbResults?.variatedParameters?.length}` - + `, hasLog: ${this?._pbResults?.hasLog}` - ); */ - if (this._pbResults && this.pbResults.variatedParameters.length > 0) { - this.mergeGlobalLog(this._pbResults.result, l); - // console.log(">>>> after merge, messages length=", l.messages.length); - // un problème avec le PB en général / les cloisons / les bassins, à une étape quelconque ? - if ( - (this.pbResults.hasLog) - && l.messages.length === 0 // existing global messages make generic message below useless - ) { - const logStats = this.logStats(); - const m = new Message(MessageCode.WARNING_PROBLEMS_ENCOUNTERED); - m.extraVar.info = "" + logStats.info; // to avoid displaying fixed number of digits - m.extraVar.warning = "" + logStats.warning; - m.extraVar.error = "" + logStats.error; - l.add(m); - } - } // sinon pas de log global (aucun paramètre ne varie) - return l; + return this._logHelper.globalLog; } - /** - * Retourne les logs à afficher dans le composant de log local, en dessous - * du sélecteur d'itération : messages concernant l'itération (le ResultElement) - * en cours - */ public get iterationLog(): cLog { - const l = new cLog(); - if (this._pbResults?.result) { - const pb = this._pbResults.result.sourceNub as PreBarrage; - if (this._pbResults.variatedParameters.length > 0) { - // A. si un paramètre varie - const vi = this._pbResults.variableIndex; - // log du PB pour l'itération en cours - if ( - this._pbResults.result - && this._pbResults.result.hasResultElements() - && this._pbResults.result.resultElements[vi] - && this._pbResults.result.resultElements[vi]?.hasLog() - ) { - l.addLog(this._pbResults.result.resultElements[vi].log); - } - // logs des enfants pour l'itération en cours - if (pb !== undefined) { - for (const pbc of pb.children) { - if (pbc?.result?.hasResultElements() && pbc.result.resultElements[vi]?.hasLog()) { - l.addLog(pbc.result.resultElements[vi].log); - } - } - } - } else { - // B. si aucun paramètre ne varie - this.mergeGlobalLog(this._pbResults.result, l); // faut bien mettre le log global quelque part - // logs des enfants - if (pb !== undefined) { - for (const pbc of pb.children) { - if (pbc?.result?.hasResultElements() && pbc.result.resultElement?.hasLog()) { - l.addLog(pbc.result.resultElement.log); - } - } - } - } - } - return l; + return this._logHelper.iterationLog; } public get uitextGeneralLogTitle(): string { diff --git a/src/app/components/variable-results-selector/variable-results-selector.component.ts b/src/app/components/variable-results-selector/variable-results-selector.component.ts index 663f1f0e5215e8875c79aba15edf1d09db0a592c..0d68b44573e4177fb943019a8516944fdbc94162 100644 --- a/src/app/components/variable-results-selector/variable-results-selector.component.ts +++ b/src/app/components/variable-results-selector/variable-results-selector.component.ts @@ -3,9 +3,9 @@ import { Component, Input, OnChanges } from "@angular/core"; import { I18nService } from "../../services/internationalisation.service"; import { fv, longestVarParam } from "../../util"; import { MultiDimensionResults } from "../../results/multidimension-results"; -import { PrebarrageResults } from "../../results/prebarrage-results"; -import { CalculatorType, PbBassin, PbCloison, Structure, VariatedDetails } from "jalhyd"; +import { VariatedDetails } from "jalhyd"; import { CalculatorResults } from "../../results/calculator-results"; +import { LogHelper } from "app/results/log-helper"; @Component({ selector: "variable-results-selector", @@ -24,6 +24,9 @@ export class VariableResultsSelectorComponent implements OnChanges { @Input() private variatedParameters: VariatedDetails[]; + /** stats du log synthétique */ + private _logHelper: LogHelper; + /** valeur en cours */ private _selectedValue = 0; @@ -61,6 +64,7 @@ export class VariableResultsSelectorComponent implements OnChanges { // get current variatedIndex even if component was rebuilt if (this.results) { this._selectedValue = this.results.variableIndex; + this._logHelper = new LogHelper(this.results); } } @@ -80,8 +84,17 @@ export class VariableResultsSelectorComponent implements OnChanges { return ret; } + /** + * generate entry text for boundary conditions select + * @param index select option index + */ protected entryLabel(index: number): string { - return CalculatorResults.variatingModalityLabel(this.varValues, this.results, index); + let res = CalculatorResults.variatingModalityLabel(this.varValues, this.results, index); + const restat = this._logHelper.resultElementsStats(index); + if (restat.length > 0) { + res += " - " + restat; + } + return res; } public get selectedValue(): number { diff --git a/src/app/results/log-helper.ts b/src/app/results/log-helper.ts new file mode 100644 index 0000000000000000000000000000000000000000..d3b75c621dc6e1575feab757459739365e64e82e --- /dev/null +++ b/src/app/results/log-helper.ts @@ -0,0 +1,155 @@ +import { ServiceFactory } from "app/services/service-factory"; +import { cLog, Message, MessageCode, Result, ResultElement } from "jalhyd"; +import { sprintf } from "sprintf-js"; +import { MultiDimensionResults } from "./multidimension-results"; + +/** + * calculation log helpers + */ +export class LogHelper { + private _childrenResults: Result[]; + private _extraResult?: Result; + + constructor(private _mdr: MultiDimensionResults) { + this._childrenResults = this._mdr.childrenResults; + this._extraResult = this._mdr.extraResult; + } + + private mergeGlobalLog(result: Result, log: cLog) { + if (result) { + if (result.hasGlobalLog()) { + log.addLog(result.globalLog); + } + // if no parameter is varying, 1st element log is considered "global" + if (this._mdr.variatedParameters.length === 0) { + if (result.hasResultElements() && result.resultElement.hasLog()) { + log.addLog(result.log); + } + } + } + } + + /** + * Returns the number of errors, warnings, infos among children logs + */ + private logStats(): any { + return this._mdr.result.sourceNub.resultElementsLogStats(); + } + + private computeResultElementLogStats(index: number): any { + let res; + const it: Iterator<ResultElement> = this._mdr.result.nthResultElementIterator(index); + let ire = it.next(); + while (!ire.done) { + res = ire.value.logStats(res); + ire = it.next(); + } + return res; + } + + private resultElementStatToString(res: any): string { + let ret = ""; + function ccat(n: number, code: MessageCode, b: string): string { + if (n > 0) { + const c: string = MessageCode[code]; + const m: string = ServiceFactory.i18nService.localizeText(c); + const s = sprintf(m, n); + if (b.length > 0) { + return b + ", " + s; + } + return s; + } + return b; + } + ret = ccat(res.error, MessageCode.WARNING_ERROR_COUNT_SHORT, ret); + ret = ccat(res.warning, MessageCode.WARNING_WARNING_COUNT_SHORT, ret); + ret = ccat(res.info, MessageCode.WARNING_INFO_COUNT_SHORT, ret); + return ret; + } + + public resultElementsStats(index: number): string { + const res = this.computeResultElementLogStats(index); + return this.resultElementStatToString(res); + } + + /* + * Retourne les logs à afficher dans le composant de log global, au dessus + * du sélecteur d'itération : messages globaux et / ou résumé des messages + * spécifiques à chaque ResultElement + */ + public get globalLog(): cLog { + const l = new cLog(); + if (this._mdr && this._mdr.variatedParameters.length > 0) { + this.mergeGlobalLog(this._mdr.result, l); + // un problème avec le nub en général / les cloisons / les bassins, à une étape quelconque ? + if ( + (this._mdr.hasLog) + && l.messages.length === 0 // existing global messages make generic message below useless + ) { + const logStats = this.logStats(); + let m: Message; + if (logStats.warning > 0) { + m = new Message(MessageCode.WARNING_WARNINGS_ABSTRACT); + m.extraVar.nb = "" + logStats.warning; + l.add(m); + } + if (logStats.error > 0) { + let c: MessageCode = logStats.error > 1 ? MessageCode.WARNING_ERRORS_ABSTRACT_PLUR : MessageCode.WARNING_ERRORS_ABSTRACT; + m = new Message(c); + m.extraVar.nb = "" + logStats.error; + l.add(m); + } + } + } // sinon pas de log global (aucun paramètre ne varie) + return l; + } + + /** + * Retourne les logs à afficher dans le composant de log local, en dessous + * du sélecteur d'itération : messages concernant l'itération (le ResultElement) + * en cours + */ + public get iterationLog(): cLog { + const l = new cLog(); + if (this._mdr?.result) { + if (this._mdr.variatedParameters.length > 0) { + // A. si un paramètre varie + const vi = this._mdr.variableIndex; + // log du PB pour l'itération en cours + if ( + this._mdr.result + && this._mdr.result.hasResultElements() + && this._mdr.result.resultElements[vi] + && this._mdr.result.resultElements[vi]?.hasLog() + ) { + l.addLog(this._mdr.result.resultElements[vi].log); + } + // logs des enfants pour l'itération en cours + for (const cr of this._childrenResults) { + if (cr.hasResultElements() && cr.resultElements[vi]?.hasLog()) { + l.addLog(cr.resultElements[vi].log); + } + } + // extra results + if (this._extraResult?.resultElements[vi].hasLog()) { + // l.addLog(this._pabResults.cloisonAvalResults.resultElements[vi].log); + l.addLog(this._extraResult.resultElements[vi].log); + } + } else { + // B. si aucun paramètre ne varie + this.mergeGlobalLog(this._mdr.result, l); // faut bien mettre le log global quelque part + // logs des enfants + for (const cr of this._childrenResults) { + if (cr.hasResultElements() && cr.resultElement?.hasLog()) { + l.addLog(cr.resultElement.log); + } + } + // extra result + if (this._extraResult?.resultElement.hasLog()) { + l.addLog(this._extraResult.resultElement.log); + } + } + } + return l; + } +} diff --git a/src/app/results/macrorugo-compound-results.ts b/src/app/results/macrorugo-compound-results.ts index 648dad61f8582849dc38c5c4b1497d04e0578b9c..560e5bc6dfea7b7e715a11a9077688186da74cd8 100644 --- a/src/app/results/macrorugo-compound-results.ts +++ b/src/app/results/macrorugo-compound-results.ts @@ -8,7 +8,7 @@ import { ChartType } from "./chart-type"; export class MacrorugoCompoundResults extends MultiDimensionResults implements PlottableData { /** résultats des modules MacroRugo enfants */ - public childrenResults: Result[]; + private _childrenResults: Result[]; /** symboles des colonnes de résultat */ protected _columns: string[]; @@ -70,7 +70,7 @@ export class MacrorugoCompoundResults extends MultiDimensionResults implements P public reset() { super.reset(); - this.childrenResults = []; + this._childrenResults = []; } /** @@ -225,4 +225,12 @@ export class MacrorugoCompoundResults extends MultiDimensionResults implements P return data; } + + public get childrenResults(): Result[] { + return this._childrenResults; + } + + public set childrenResults(cr: Result[]) { + this._childrenResults = cr; + } } diff --git a/src/app/results/multidimension-results.ts b/src/app/results/multidimension-results.ts index c7af4cc990ab030b530ce740f5147cb22fa436d2..dd12a46863906218fa2c407a01689110048babe4 100644 --- a/src/app/results/multidimension-results.ts +++ b/src/app/results/multidimension-results.ts @@ -1,7 +1,6 @@ import { CalculatedParamResults } from "./param-calc-results"; -import { VariatedDetails } from "jalhyd"; - +import { Result, VariatedDetails } from "jalhyd"; export class MultiDimensionResults extends CalculatedParamResults { @@ -19,4 +18,12 @@ export class MultiDimensionResults extends CalculatedParamResults { public set variableIndex(v: number) { this._variableIndex = v; } + + public get childrenResults(): Result[] { + return []; + } + + public get extraResult(): Result { + return undefined; + } } diff --git a/src/app/results/pab-results.ts b/src/app/results/pab-results.ts index d282524efac3c6e3f05d8e0936f4d15134f74f58..2f96053696acb3b0087421f084e992cfe0c0baa8 100644 --- a/src/app/results/pab-results.ts +++ b/src/app/results/pab-results.ts @@ -256,4 +256,12 @@ export class PabResults extends MultiDimensionResults implements PlottableData { return data; } + + public get childrenResults(): Result[] { + return this.cloisonsResults; + } + + public get extraResult(): Result { + return this.cloisonAvalResults; + } } diff --git a/src/app/results/prebarrage-results.ts b/src/app/results/prebarrage-results.ts index 0c734ae512e0964dff88a58cffa582a3c99c5165..411c4edd7354211f1dc1bea5f54c180ae3590da9 100644 --- a/src/app/results/prebarrage-results.ts +++ b/src/app/results/prebarrage-results.ts @@ -24,6 +24,9 @@ export class PrebarrageResults extends MultiDimensionResults implements IObserva /** Implémentation par délégation */ private _observable: Observable; + /** résultats enfants */ + private _childrenResults: Result[]; + public constructor() { super(); this._observable = new Observable(); @@ -83,6 +86,7 @@ export class PrebarrageResults extends MultiDimensionResults implements IObserva this.cloisonResults.variableIndex = this._variableIndex; this.cloisonResults.size = this.size; this.result = undefined; + this._childrenResults = undefined; } /** @@ -163,6 +167,22 @@ export class PrebarrageResults extends MultiDimensionResults implements IObserva return err; } + /** liste des résultats enfants */ + public get childrenResults(): Result[] { + if (this._childrenResults === undefined) { + this._childrenResults = []; + const sn = this.result?.sourceNub as PreBarrage; + if (sn?.children) { + for (const cr of sn.children) { + if (cr.result) { + this._childrenResults.push(cr.result); + } + } + } + } + return this._childrenResults; + } + // interface IObservable /** diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index 022f3ee461f807220333e6d23369ae20e9ffc99d..649e9e7c1263d8a781b259050a633a3648b29e89 100755 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -7,6 +7,10 @@ "WARNING_NOTCH_SUBMERSION_GREATER_THAN_07": "Notch formula is discouraged when submersion is greater than 0.7", "WARNING_SLOT_SUBMERSION_NOT_BETWEEN_07_AND_09": "Slot formula is discouraged when submersion is lower than 0.7 or greater than 0.9", "WARNING_WEIR_SUBMERSION_LOWER_THAN_08": "Submerged weir formula is discouraged when submersion is lower than 08", + "WARNING_INFO_COUNT_SHORT": "%d info(s)", + "WARNING_WARNING_COUNT_SHORT": "%d warning(s)", + "WARNING_ERROR_COUNT_SHORT": "%d error(s)", + "WARNING_WARNINGS_ABSTRACT": "%nb% warnings occurred during calculation", "WARNING_ERRORS_ABSTRACT": "%nb% error occurred during calculation", "WARNING_ERRORS_ABSTRACT_PLUR": "%nb% errors occurred during calculation", "ERROR_BIEF_Z1_CALC_FAILED": "Unable to calculate upstream elevation (calculation interrupted before upstream)", @@ -553,7 +557,6 @@ "INFO_QUICKNAV_INPUT": "input", "INFO_QUICKNAV_RESULTS": "results", "WARNING_PREBARRAGE_BASSIN_ZF_SUP_Z1": "Bottom elevation of basin #%n% is greater than upstream water elevation", - "WARNING_PROBLEMS_ENCOUNTERED": "Problems occurred during calculation (info: %info%, warning: %warning%, error: %error%)", "INFO_REGIMEUNIFORME_DESCRIPTION": "open-channel flow normal depth", "INFO_REGIMEUNIFORME_TITRE_COURT": "Uniform flow", "INFO_REGIMEUNIFORME_TITRE": "Uniform flow calculation", @@ -570,7 +573,7 @@ "INFO_REMOUSRESULTS_TIRANT": "Water depth (m)", "INFO_REMOUSRESULTS_TIRANTCRITIQUE": "Critical water level", "INFO_REMOUSRESULTS_TIRANTNORMAL": "Normal water level", - "INFO_REPORT_BUG_BODY": "This is an issue report.\n\nPlease describe quickly the issue you encoutered, and the steps you followed:\n\n\n\n\n--- Current session state - do not modify text below ---\n------------------------------------------------------------------------\n\n", + "INFO_REPORT_BUG_BODY": "This is an issue report.\n\nPlease describe quickly the issue you encountered, and the steps you followed:\n\n\n\n\n--- Current session state - do not modify text below ---\n------------------------------------------------------------------------\n\n", "INFO_REPORT_BUG_SUBJECT": "Issue report", "INFO_REQUIRES": "requires", "INFO_RESULTS_EXPORT_AS_SPREADSHEET": "Export as XLSX", @@ -658,7 +661,6 @@ "INFO_ESPECE_TITRE": "Fish species characteristics", "INFO_ESPECE_DESCRIPTION": "ichtyocompatible", "INFO_ESPECE_TITRE_COURT": "Species", - "WARNING_WARNINGS_ABSTRACT": "%nb% warnings occurred during calculation", "ERROR_JET_SUBMERGED_NO_SOLUTION": "There is no solution", "WARNING_DEVER_ZDV_INF_ZR": "Apron elevation of structure #%number% is below river bed elevation", "WARNING_JET_START_SUBMERGED": "Water elevation is greater than jet start elevation", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index 6e487527a3f6a9a6e897c53855ef36410d77c039..cb3e769e68c4ea5dd34f2c4f1ce36dacd4e84b91 100755 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -7,6 +7,10 @@ "WARNING_NOTCH_SUBMERSION_GREATER_THAN_07": "La formule de l'échancrure n'est pas conseillée pour un ennoiement supérieur à 0.7", "WARNING_SLOT_SUBMERSION_NOT_BETWEEN_07_AND_09": "La formule de la fente n'est pas conseillée pour un ennoiement inférieur à 0.7 et supérieur à 0.9", "WARNING_WEIR_SUBMERSION_LOWER_THAN_08": "La formule du seuil noyé n'est pas conseillé pour un ennoiement inférieur à 0.8", + "WARNING_INFO_COUNT_SHORT": "%d info(s)", + "WARNING_WARNING_COUNT_SHORT": "%d avertissement(s)", + "WARNING_ERROR_COUNT_SHORT": "%d erreur(s)", + "WARNING_WARNINGS_ABSTRACT": "%nb% avertissements rencontrés lors du calcul", "WARNING_ERRORS_ABSTRACT": "%nb% erreur rencontrée lors du calcul", "WARNING_ERRORS_ABSTRACT_PLUR": "%nb% erreurs rencontrées lors du calcul", "ERROR_BIEF_Z1_CALC_FAILED": "Impossible de calculer la cote amont (calcul interrompu avant l'amont)", @@ -554,7 +558,6 @@ "INFO_QUICKNAV_INPUT": "données", "INFO_QUICKNAV_RESULTS": "résultats", "WARNING_PREBARRAGE_BASSIN_ZF_SUP_Z1": "Cote de fond du bassin n°%n% supérieure à la cote de l'eau amont", - "WARNING_PROBLEMS_ENCOUNTERED": "Des problèmes sont survenus durant le calcul (info : %info%, avertissement : %warning%, erreur : %error%)", "INFO_REGIMEUNIFORME_DESCRIPTION": "hydraulique à surface libre hauteur normale", "INFO_REGIMEUNIFORME_TITRE_COURT": "R. uniforme", "INFO_REGIMEUNIFORME_TITRE": "Régime uniforme", @@ -659,7 +662,6 @@ "INFO_ESPECE_TITRE": "Caractéristiques d'une espèce", "INFO_ESPECE_DESCRIPTION": "ichtyocompatible", "INFO_ESPECE_TITRE_COURT": "Espèce", - "WARNING_WARNINGS_ABSTRACT": "%nb% avertissements rencontrés lors du calcul", "ERROR_JET_SUBMERGED_NO_SOLUTION": "Il n'y a pas de solution", "WARNING_DEVER_ZDV_INF_ZR": "La cote de radier de l'ouvrage n°%number% est sous la cote de fond du lit", "WARNING_JET_START_SUBMERGED": "La cote de l'eau est supérieure à la cote de départ du jet",