diff --git a/onecgiar-pr-server/src/api/m-qap/dtos/m-qap.dto.ts b/onecgiar-pr-server/src/api/m-qap/dtos/m-qap.dto.ts index 4df11b7c2..5270e579a 100644 --- a/onecgiar-pr-server/src/api/m-qap/dtos/m-qap.dto.ts +++ b/onecgiar-pr-server/src/api/m-qap/dtos/m-qap.dto.ts @@ -119,6 +119,7 @@ export class MQAPResultDto { repo: string; 'Geographic location': CgRegion | CgRegion[]; agrovoc_keywords: AgrovocKeywords; + 'AGROVOC Keywords': AgrovocKeywords; Commodities: string[]; handle_altmetric: AltmetricData; DOI_Info: DOIInfo; diff --git a/onecgiar-pr-server/src/api/results/results-knowledge-products/results-knowledge-products.mapper.ts b/onecgiar-pr-server/src/api/results/results-knowledge-products/results-knowledge-products.mapper.ts index 39d0f7468..06d173d14 100644 --- a/onecgiar-pr-server/src/api/results/results-knowledge-products/results-knowledge-products.mapper.ts +++ b/onecgiar-pr-server/src/api/results/results-knowledge-products/results-knowledge-products.mapper.ts @@ -75,7 +75,8 @@ export class ResultsKnowledgeProductMapper { return author; }); - const keywords = dto?.agrovoc_keywords?.results; + const keywords = + dto?.agrovoc_keywords?.results ?? dto?.['AGROVOC Keywords'].results ?? []; knowledgeProductDto.keywords = (keywords ?? []) .filter((k) => !k.is_agrovoc) .map((k) => k.keyword); diff --git a/onecgiar-pr-server/src/api/results/results-validation-module/results-validation-module.repository.ts b/onecgiar-pr-server/src/api/results/results-validation-module/results-validation-module.repository.ts index 2e1f309f9..454dd3db5 100644 --- a/onecgiar-pr-server/src/api/results/results-validation-module/results-validation-module.repository.ts +++ b/onecgiar-pr-server/src/api/results/results-validation-module/results-validation-module.repository.ts @@ -1195,6 +1195,15 @@ export class resultValidationRepository AND ( SELECT CASE + WHEN ( + SELECT COUNT(*) + FROM result_answers ra + LEFT JOIN result_questions rq345 on ra.result_question_id = rq345.result_question_id + WHERE ra.result_id = r.id + AND rq345.parent_question_id IN (2, 3) + AND ra.result_question_id NOT IN (4,8) + AND ra.answer_boolean = TRUE + ) > 0 THEN 1 WHEN ( SELECT COUNT(*) FROM result_answers ra @@ -1404,21 +1413,39 @@ export class resultValidationRepository ) AND ( SELECT - COUNT(*) - FROM - result_answers ra - LEFT JOIN result_questions rq ON rq.result_question_id = ra.result_question_id - WHERE - ra.result_id = r.id - AND ra.result_question_id = 47 - AND ( - coalesce(ra.answer_boolean, 0) = 0 - OR( - ra.answer_boolean = TRUE - AND COALESCE(TRIM(ra.answer_text), '') <> '' - ) - ) - ) > 0 + CASE + WHEN ( + SELECT + COUNT(*) + FROM + result_answers ra + LEFT JOIN result_questions rq ON rq.result_question_id = ra.result_question_id + WHERE + ra.result_id = r.id + AND rq.parent_question_id = 38 + AND ra.answer_boolean = TRUE + AND ra.result_question_id <> 39 + ) > 0 THEN 1 + WHEN ( + SELECT + COUNT(*) + FROM + result_answers ra + LEFT JOIN result_questions rq ON rq.result_question_id = ra.result_question_id + WHERE + ra.result_id = r.id + AND ra.result_question_id = 47 + AND ( + coalesce(ra.answer_boolean, 0) = 0 + OR( + ra.answer_boolean = TRUE + AND COALESCE(TRIM(ra.answer_text), '') <> '' + ) + ) + ) > 0 THEN 1 + ELSE 0 + END + ) ) AND ( #megatrends