From 40bff3f0b4e2045c1682085afa11fb124f7ceb31 Mon Sep 17 00:00:00 2001 From: Jean-Pascal <jean-pascal.aubry@inrae.fr> Date: Thu, 30 May 2024 09:06:14 +0000 Subject: [PATCH] fix: change way to get search parameter related calculator title Refs #668 --- .../elements/select/select-field-searched-param.ts | 5 +++-- src/app/services/formulaire.service.ts | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/app/formulaire/elements/select/select-field-searched-param.ts b/src/app/formulaire/elements/select/select-field-searched-param.ts index 8811ef81f..2b5e1a501 100644 --- a/src/app/formulaire/elements/select/select-field-searched-param.ts +++ b/src/app/formulaire/elements/select/select-field-searched-param.ts @@ -23,11 +23,12 @@ export class SelectFieldSearchedParam extends SelectField { ntc, solv.targettedResult !== undefined && solv.targettedResult !== "" ); + for (const p of searchableParams) { if (p.visible) { - const calc = fs.getFormulaireFromId(p.originNub.uid).calculatorName; + const calcTitle = fs.getTitlebyIdOnSelectedLoadedNubs(p.originNub.uid).title; const varName = fs.expandVariableName(p.originNub.calcType, p.symbol); - const label = `${p.symbol} - ${varName} (${calc})`; + const label = `${p.symbol} - ${varName} (${calcTitle})`; this.addEntry(this.createOrGetEntry(this._entriesBaseId + p.getParentComputeNode(false).uid + "_" + p.symbol, p, decodeHtml(label))); } } diff --git a/src/app/services/formulaire.service.ts b/src/app/services/formulaire.service.ts index ad8d6b1b1..24c3c820b 100644 --- a/src/app/services/formulaire.service.ts +++ b/src/app/services/formulaire.service.ts @@ -71,6 +71,8 @@ export class FormulaireService extends Observable { private _currentFormId: string = null; + private _selectedLoadedNubs: any[] = []; + public static getConfigPathPrefix(ct: CalculatorType): string { const ctName = CalculatorType[ct].toLowerCase(); return "app/calculators/" + ctName + "/"; @@ -91,6 +93,10 @@ export class FormulaireService extends Observable { return this._formulaires; } + public getTitlebyIdOnSelectedLoadedNubs(uid: string) { + return this._selectedLoadedNubs.find(selectedNub => selectedNub.uid === uid) + } + /** Removes all formulaires from the list */ public clearFormulaires() { this._formulaires = []; @@ -646,6 +652,7 @@ export class FormulaireService extends Observable { // disable "empty fields" flag temporarly const emptyFields = ServiceFactory.applicationSetupService.enableEmptyFieldsOnFormInit; ServiceFactory.applicationSetupService.enableEmptyFieldsOnFormInit = false; + this._selectedLoadedNubs = formInfos; let s; if (i instanceof Blob) { @@ -700,6 +707,10 @@ export class FormulaireService extends Observable { } } + getSelectedLoadedNubs() { + return this._selectedLoadedNubs; + } + /** * Sends an UTF-8 text file for download */ -- GitLab