diff --git a/onecgiar-pr-client/src/app/pages/outcome-indicator/pages/eioi-home/eoio-home.component.html b/onecgiar-pr-client/src/app/pages/outcome-indicator/pages/eioi-home/eoio-home.component.html index c52da4f10..cf8532013 100644 --- a/onecgiar-pr-client/src/app/pages/outcome-indicator/pages/eioi-home/eoio-home.component.html +++ b/onecgiar-pr-client/src/app/pages/outcome-indicator/pages/eioi-home/eoio-home.component.html @@ -14,7 +14,7 @@

Indicator list

id="resultListTable" #table [value]="this.outcomeIService.eoisData | appFilterIndicatorBySearch: this.outcomeIService.searchText()" - sortField="toc_result_description" + sortField="toc_result_title" [sortOrder]="1" styleClass="p-datatable-gridlines p-datatable-sm" [rows]="8" @@ -27,7 +27,7 @@

Indicator list

[tableStyle]="{ 'min-width': '80rem' }"> - Outcome + Outcome Indicator Indicator Type Expected Target @@ -40,7 +40,7 @@

Indicator list

@let indicator = item.indicators?.[0]; - {{ item?.toc_result_description ?? 'No data found.' }} + {{ item?.toc_result_title ?? 'No data found.' }} @if (!indicator) { No indicator data found. } @else { @@ -57,10 +57,10 @@

Indicator list

{{ indicator?.indicator_name ?? 'No data found.' }} {{ indicator?.indicator_target_value ?? 'Not defined' }} - {{ indicator?.indicator_achieved_value ?? 'Not defined' }} + {{ indicator?.indicator_achieved_value ?? 'Not provided' }} {{ - this.outcomeIService.achievedStatus(indicator?.indicator_target_value, indicator?.indicator_achieved_value) ? 'Achieved' : 'Not Achieved' + this.outcomeIService.achievedStatus(indicator?.indicator_target_value, indicator?.indicator_achieved_value) ? 'Achieved' : 'Not achieved' }} diff --git a/onecgiar-pr-client/src/app/pages/outcome-indicator/pages/outcome-indicator-home/outcome-indicator-home.component.ts b/onecgiar-pr-client/src/app/pages/outcome-indicator/pages/outcome-indicator-home/outcome-indicator-home.component.ts index 451e5a7eb..a7e050f6a 100644 --- a/onecgiar-pr-client/src/app/pages/outcome-indicator/pages/outcome-indicator-home/outcome-indicator-home.component.ts +++ b/onecgiar-pr-client/src/app/pages/outcome-indicator/pages/outcome-indicator-home/outcome-indicator-home.component.ts @@ -36,7 +36,7 @@ export class OutcomeIndicatorHomeComponent { const wscolsWPs = [ { header: 'Workpackage name', key: 'workpackage_name', width: 50 }, - { header: 'Outcome', key: 'toc_result_description', width: 50 }, + { header: 'Outcome', key: 'toc_result_title', width: 50 }, { header: 'Indicator', key: 'indicator_name', width: 50 }, { header: 'Indicator Type', key: 'indicator_type', width: 50 }, { header: 'Expected target', key: 'expected_target', width: 22 }, diff --git a/onecgiar-pr-client/src/app/pages/outcome-indicator/pages/wp-home/wp-home.component.html b/onecgiar-pr-client/src/app/pages/outcome-indicator/pages/wp-home/wp-home.component.html index 4b436700e..fdb8c3294 100644 --- a/onecgiar-pr-client/src/app/pages/outcome-indicator/pages/wp-home/wp-home.component.html +++ b/onecgiar-pr-client/src/app/pages/outcome-indicator/pages/wp-home/wp-home.component.html @@ -66,7 +66,7 @@

Indicator list

@for (result of item.toc_results; track $index) { @if (result.indicators.length === 0 && result.isVisible) { - {{ result?.toc_result_description }} + {{ result?.toc_result_title }} No indicator data found } @else { @@ -74,7 +74,7 @@

Indicator list

@if (indicator.isVisible) { @if ($index === 0) { - {{ result?.toc_result_description }} + {{ result?.toc_result_title }} } Indicator list {{ indicator?.indicator_name }} {{ indicator?.indicator_target_value ?? 'Not defined' }} - {{ indicator?.indicator_achieved_value ?? 'Not defined' }} + {{ indicator?.indicator_achieved_value ?? 'Not provided' }} {{ this.outcomeIService.achievedStatus(indicator?.indicator_target_value, indicator?.indicator_achieved_value) ? 'Achieved' - : 'Not Achieved' + : 'Not achieved' }} diff --git a/onecgiar-pr-client/src/app/pages/outcome-indicator/pipes/filter-indicator-by-search.pipe.spec.ts b/onecgiar-pr-client/src/app/pages/outcome-indicator/pipes/filter-indicator-by-search.pipe.spec.ts index 18b1b8180..993ff5550 100644 --- a/onecgiar-pr-client/src/app/pages/outcome-indicator/pipes/filter-indicator-by-search.pipe.spec.ts +++ b/onecgiar-pr-client/src/app/pages/outcome-indicator/pipes/filter-indicator-by-search.pipe.spec.ts @@ -19,7 +19,7 @@ describe('FilterIndicatorBySearchPipe', () => { describe('Default filtering (non-WPsTable)', () => { const mockList = [ { - toc_result_description: 'Result 1', + toc_result_title: 'Result 1', indicators: [ { indicator_name: 'Indicator 1', @@ -29,7 +29,7 @@ describe('FilterIndicatorBySearchPipe', () => { ] }, { - toc_result_description: 'Result 2', + toc_result_title: 'Result 2', indicators: [ { indicator_name: 'Indicator 2', @@ -48,13 +48,13 @@ describe('FilterIndicatorBySearchPipe', () => { it('should filter by result description', () => { const result = pipe.transform(mockList, 'Result 1', false); expect(result.length).toBe(1); - expect(result[0].toc_result_description).toBe('Result 1'); + expect(result[0].toc_result_title).toBe('Result 1'); }); it('should be case insensitive', () => { const result = pipe.transform(mockList, 'result 1', false); expect(result.length).toBe(1); - expect(result[0].toc_result_description).toBe('Result 1'); + expect(result[0].toc_result_title).toBe('Result 1'); }); }); @@ -63,7 +63,7 @@ describe('FilterIndicatorBySearchPipe', () => { { toc_results: [ { - toc_result_description: 'WP Result 1', + toc_result_title: 'WP Result 1', indicators: [{ indicator_description: 'WP Indicator 1' }, { indicator_description: 'WP Indicator 2' }] } ] @@ -71,7 +71,7 @@ describe('FilterIndicatorBySearchPipe', () => { { toc_results: [ { - toc_result_description: 'WP Result 2', + toc_result_title: 'WP Result 2', indicators: [{ indicator_description: 'WP Indicator 3' }] } ] @@ -86,7 +86,7 @@ describe('FilterIndicatorBySearchPipe', () => { it('should filter by result description in WPsTable mode', () => { const result = pipe.transform(mockWPsList, 'WP Result 1', true); expect(result.length).toBe(1); - expect(result[0].toc_results[0].toc_result_description).toBe('WP Result 1'); + expect(result[0].toc_results[0].toc_result_title).toBe('WP Result 1'); }); it('should filter by indicator description in WPsTable mode', () => { @@ -121,7 +121,7 @@ describe('FilterIndicatorBySearchPipe', () => { }); it('should handle undefined search filter', () => { - const mockList = [{ toc_result_description: 'Test' }]; + const mockList = [{ toc_result_title: 'Test' }]; expect(() => pipe.transform(mockList, undefined as any, false)).not.toThrow(); }); }); diff --git a/onecgiar-pr-client/src/app/pages/outcome-indicator/pipes/filter-indicator-by-search.pipe.ts b/onecgiar-pr-client/src/app/pages/outcome-indicator/pipes/filter-indicator-by-search.pipe.ts index fac5f7ab9..66dd51263 100644 --- a/onecgiar-pr-client/src/app/pages/outcome-indicator/pipes/filter-indicator-by-search.pipe.ts +++ b/onecgiar-pr-client/src/app/pages/outcome-indicator/pipes/filter-indicator-by-search.pipe.ts @@ -41,12 +41,12 @@ export class FilterIndicatorBySearchPipe implements PipeTransform { return ( !searchUpper || indicator.indicator_description.toUpperCase().includes(searchUpper) || - result.toc_result_description.toUpperCase().includes(searchUpper) + result.toc_result_title.toUpperCase().includes(searchUpper) ); } private isResultVisible(result: any, searchUpper: string): boolean { - return result.toc_result_description.toUpperCase().includes(searchUpper); + return result.toc_result_title.toUpperCase().includes(searchUpper); } private resetIndicators(list: any[]): void { @@ -83,7 +83,7 @@ export class FilterIndicatorBySearchPipe implements PipeTransform { } private createWPsTableString(item: any): string { - return item.toc_results.map(result => result.toc_result_description).join(', '); + return item.toc_results.map(result => result.toc_result_title).join(', '); } private createDefaultString(item: any): string { @@ -95,6 +95,6 @@ export class FilterIndicatorBySearchPipe implements PipeTransform { indicatorType = indicator.is_indicator_custom ? 'Custom -' : 'Standard -'; } - return `${item?.toc_result_description || ''} ${indicator.indicator_description || ''} ${indicatorType} ${indicatorName}`; + return `${item?.toc_result_title || ''} ${indicator.indicator_description || ''} ${indicatorType} ${indicatorName}`; } } diff --git a/onecgiar-pr-client/src/app/pages/outcome-indicator/services/outcome-indicator.service.ts b/onecgiar-pr-client/src/app/pages/outcome-indicator/services/outcome-indicator.service.ts index 07ac53f66..5a84ecf4d 100644 --- a/onecgiar-pr-client/src/app/pages/outcome-indicator/services/outcome-indicator.service.ts +++ b/onecgiar-pr-client/src/app/pages/outcome-indicator/services/outcome-indicator.service.ts @@ -66,6 +66,10 @@ export class OutcomeIndicatorService { this.api.resultsSE.GET_contributionsToIndicatorsWPS(this.initiativeIdFilter).subscribe({ next: res => { this.wpsData = res.data.map(item => { + item.toc_results.sort((a, b) => { + return (a.toc_result_title || '').localeCompare(b.toc_result_title || ''); + }); + item.toc_results.forEach(result => { if (result.indicators === null) { result.indicators = []; @@ -73,6 +77,8 @@ export class OutcomeIndicatorService { }); return item; }); + console.log(this.wpsData); + this.loadingWPs.set(false); this.expandAll(); }, diff --git a/onecgiar-pr-client/src/app/shared/services/export-tables.service.ts b/onecgiar-pr-client/src/app/shared/services/export-tables.service.ts index d4f0246e8..1413cf400 100644 --- a/onecgiar-pr-client/src/app/shared/services/export-tables.service.ts +++ b/onecgiar-pr-client/src/app/shared/services/export-tables.service.ts @@ -236,20 +236,20 @@ export class ExportTablesService { } const supportingResults = !data.indicators[0]?.indicator_supporting_results - ? 'Not defined' + ? 'Not provided' : data.indicators[0]?.indicator_supporting_results.map(item => `• ${item.result_type} ${item.result_code} - ${item.result_title}`).join('\n'); worksheet.addRow({ - toc_result_title: data.toc_result_description ?? 'Not defined', + toc_result_title: data.toc_result_title ?? 'Not defined', indicator_name: data.indicators[0]?.indicator_description ?? 'Not defined', indicator_type: indicatorType, expected_target: data.indicators[0]?.indicator_target_value ?? 'Not defined', - actual_target_achieved: data.indicators[0]?.indicator_achieved_value ?? 'Not defined', + actual_target_achieved: data.indicators[0]?.indicator_achieved_value ?? 'Not provided', achieved_status: this.outcomeIService.achievedStatus(data.indicators[0]?.indicator_target_value, data.indicators[0]?.indicator_achieved_value) ? 'Yes' : 'No', reporting_status: data.indicators[0]?.indicator_submission_status ? 'Submitted' : 'Editing', - indicator_achieved_narrative: data.indicators[0]?.indicator_achieved_narrative ?? 'Not defined', + indicator_achieved_narrative: data.indicators[0]?.indicator_achieved_narrative ?? 'Not provided', indicator_supporting_results: supportingResults }); } @@ -264,34 +264,34 @@ export class ExportTablesService { indicatorType = `${prefix} ${indicator.indicator_name}`; } const supportingResults = !indicator.indicator_supporting_results - ? 'Not defined' + ? 'Not provided' : indicator.indicator_supporting_results.map(item => `• ${item.result_type} ${item.result_code} - ${item.result_title}`).join('\n'); worksheet.addRow({ workpackage_name: `${data.workpackage_short_name}: ${data.workpackage_name}`, - toc_result_description: result.toc_result_description ?? 'Not defined', + toc_result_title: result.toc_result_title ?? 'Not defined', indicator_name: indicator.indicator_description ?? 'Not defined', indicator_type: indicatorType, expected_target: indicator.indicator_target_value ?? 'Not defined', - actual_target_achieved: indicator.indicator_achieved_value ?? 'Not defined', + actual_target_achieved: indicator.indicator_achieved_value ?? 'Not provided', achieved_status: this.outcomeIService.achievedStatus(indicator.indicator_target_value, indicator.indicator_achieved_value) ? 'Yes' : 'No', reporting_status: indicator.indicator_submission_status ? 'Submitted' : 'Editing', - indicator_achieved_narrative: indicator.indicator_achieved_narrative ?? 'Not defined', + indicator_achieved_narrative: indicator.indicator_achieved_narrative ?? 'Not provided', indicator_supporting_results: supportingResults }); }); } else { worksheet.addRow({ workpackage_name: `${data.workpackage_short_name}: ${data.workpackage_name}`, - toc_result_description: result.toc_result_description ?? 'Not defined', + toc_result_title: result.toc_result_title ?? 'Not defined', indicator_name: 'Not defined', indicator_type: 'Not defined', expected_target: 'Not defined', - actual_target_achieved: 'Not defined', + actual_target_achieved: 'Not provided', achieved_status: 'No', reporting_status: 'Editing', - indicator_achieved_narrative: 'Not defined', - indicator_supporting_results: 'Not defined' + indicator_achieved_narrative: 'Not provided', + indicator_supporting_results: 'Not provided' }); } });