@if ($index === 0) {
- {{ result?.toc_result_description }} |
+ {{ result?.toc_result_title }} |
}
{
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 022ea55b0..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
@@ -240,7 +240,7 @@ export class ExportTablesService {
: 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',
@@ -269,7 +269,7 @@ export class ExportTablesService {
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',
@@ -283,7 +283,7 @@ export class ExportTablesService {
} 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',
|