Skip to content
Snippets Groups Projects
Commit e70b9b1f authored by mathias.chouet's avatar mathias.chouet
Browse files

Fix #425 - PAR: show results in convenient order

parent a1c79107
No related branches found
No related tags found
1 merge request!99Devel - PAR
......@@ -89,31 +89,11 @@ export class FixedResultsComponent extends ResultsComponentDirective {
*/
protected buildCustomOrderedDataset() {
const data = [];
for (const symbol of this._fixedResults.variablesOrder) {
// is it a fixed parameter ?
for (const fp of this.fixedParams) {
if (fp.symbol === symbol) {
let label = this.formattedLabel(fp);
const nub = fp.paramDefinition.parentNub;
// add child type and position before label
if (nub && nub.parent && nub.parent.childrenType) {
const pos = nub.findPositionInParent();
// label = this.intlService.localizeText("INFO_OUVRAGE") + " n°" + (pos + 1) + ": " + label;
const cn = capitalize(this.intlService.childName(nub.parent));
label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn)
+ (pos + 1) + ": " + label;
}
label += this._fixedResults.getHelpLink(symbol);
data.push({
label: label,
value: this.formattedValue(fp),
isCalcResult: false // for CSS
});
}
}
let resultFound: boolean;
// is it a result or child result ?const res = this._fixedResults.result;
for (const symbol of this._fixedResults.variablesOrder) {
resultFound = false;
// 1) is it a result or child result ?
const res = this._fixedResults.result;
if (
res
......@@ -152,12 +132,14 @@ export class FixedResultsComponent extends ResultsComponentDirective {
}
}
resultFound = found;
// 2.2. children results
if (! found) {
for (const c of sn.getChildren()) {
if (c.result) {
for (const k of c.result.resultElement.keys) {
if (k === symbol) {
resultFound = true;
const er: number = c.result.resultElement.getValue(k);
// calculator type for translation
let ct = sn.calcType;
......@@ -180,6 +162,30 @@ export class FixedResultsComponent extends ResultsComponentDirective {
}
}
}
// 2) else, is it a fixed parameter ?
if (! resultFound) {
for (const fp of this.fixedParams) {
if (fp.symbol === symbol) {
let label = this.formattedLabel(fp);
const nub = fp.paramDefinition.parentNub;
// add child type and position before label
if (nub && nub.parent && nub.parent.childrenType) {
const pos = nub.findPositionInParent();
// label = this.intlService.localizeText("INFO_OUVRAGE") + " n°" + (pos + 1) + ": " + label;
const cn = capitalize(this.intlService.childName(nub.parent));
label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn)
+ (pos + 1) + ": " + label;
}
label += this._fixedResults.getHelpLink(symbol);
data.push({
label: label,
value: this.formattedValue(fp),
isCalcResult: false // for CSS
});
}
}
}
}
return data;
}
......
import { FormulaireFixedVar } from "./form-fixedvar";
/**
* Formulaire pour les PAR Calage
*/
export class FormulairePAR extends FormulaireFixedVar {
constructor() {
super();
// custom variables order for results tables
this.fixedResults.variablesOrder = [
"Q", "Z1", "Z2", "ha", "S", "L", "a", "N", "M",
"h", "qStar", "V", "ZD1", "ZR1", "ZD2", "ZR2", "P", "Nb", "LPI", "LPH",
"A", "B", "C", "D", "H", "Hmin", "Hmax", "ZM"
];
}
}
......@@ -40,6 +40,7 @@ import { AppComponent } from "../app.component";
import { FormulaireSPP } from "../formulaire/definition/form-spp";
import { FormulaireFixedVar } from "../formulaire/definition/form-fixedvar";
import { FormulaireSection } from "../formulaire/definition/form-section";
import { FormulairePAR } from "../formulaire/definition/form-par";
@Injectable()
export class FormulaireService extends Observable {
......@@ -299,6 +300,11 @@ export class FormulaireService extends Observable {
f = new FormulaireGrille();
break;
case CalculatorType.Par:
case CalculatorType.ParSimulation:
f = new FormulairePAR();
break;
case CalculatorType.Solveur:
f = new FormulaireSolveur();
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment