From 719018edb57f9b598a5716997ba6fc3f8037dd5d Mon Sep 17 00:00:00 2001 From: Kenji Tanaka Date: Thu, 22 Feb 2024 10:48:39 -0500 Subject: [PATCH] :wrench: chore(Shfrm contribution): Update labels and composed name in shfrm dropdowns --- ...verableShfrmPriorityActionManagerImpl.java | 39 ++++++++++++------- .../main/resources/custom/aicrra.properties | 4 +- .../src/main/resources/global.properties | 4 +- .../global/macros/deliverableMacros.ftl | 2 +- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/manager/impl/DeliverableShfrmPriorityActionManagerImpl.java b/marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/manager/impl/DeliverableShfrmPriorityActionManagerImpl.java index a46fc66a06..350a513f78 100644 --- a/marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/manager/impl/DeliverableShfrmPriorityActionManagerImpl.java +++ b/marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/manager/impl/DeliverableShfrmPriorityActionManagerImpl.java @@ -71,14 +71,19 @@ public void deleteDeliverableShfrmPriorityActionPhase(Phase next, long deliverab Phase phase = phaseDAO.find(next.getId()); DeliverableShfrmPriorityAction deliverableShfrmPriorityActionDelete = new DeliverableShfrmPriorityAction(); - deliverableShfrmPriorityActionDelete = - deliverableShfrmPriorityActionDAO.findByDeliverableAndPhase(deliverableId, phase.getId()).stream() + + try { + deliverableShfrmPriorityActionDelete = deliverableShfrmPriorityActionDAO + .findByDeliverableAndPhase(deliverableId, phase.getId()).stream() .filter(d -> d != null && deliverableShfrmPriorityAction != null && deliverableShfrmPriorityAction.getShfrmPriorityAction() != null && deliverableShfrmPriorityAction.getShfrmPriorityAction().getId() != null && d.getShfrmPriorityAction() != null && d.getShfrmPriorityAction().getId() != null && d.getShfrmPriorityAction().getId().equals(deliverableShfrmPriorityAction.getShfrmPriorityAction().getId())) .collect(Collectors.toList()).get(0); + } catch (Exception e) { + logger.info("No priority actions " + e); + } if (deliverableShfrmPriorityActionDelete != null) { deliverableShfrmPriorityActionDAO @@ -157,18 +162,24 @@ public void saveDeliverableShfrmPriorityActionPhase(Phase next, long deliverable logger.error("error getting deliverableShfrmPriorityActionPhase: " + e); } - if (deliverableShfrmPriorityActionPhase != null) { - DeliverableShfrmPriorityAction deliverableShfrmPriorityActionAdd = deliverableShfrmPriorityActionPhase; - deliverableShfrmPriorityActionAdd.setDeliverable(deliverableShfrmPriorityAction.getDeliverable()); - deliverableShfrmPriorityActionAdd.setPhase(phase); - deliverableShfrmPriorityActionAdd.setShfrmPriorityAction(deliverableShfrmPriorityAction.getShfrmPriorityAction()); - deliverableShfrmPriorityActionDAO.save(deliverableShfrmPriorityActionAdd); - } else { - DeliverableShfrmPriorityAction deliverableShfrmPriorityActionAdd = new DeliverableShfrmPriorityAction(); - deliverableShfrmPriorityActionAdd.setDeliverable(deliverableShfrmPriorityAction.getDeliverable()); - deliverableShfrmPriorityActionAdd.setPhase(phase); - deliverableShfrmPriorityActionAdd.setShfrmPriorityAction(deliverableShfrmPriorityAction.getShfrmPriorityAction()); - deliverableShfrmPriorityActionDAO.save(deliverableShfrmPriorityActionAdd); + try { + if (deliverableShfrmPriorityActionPhase != null) { + DeliverableShfrmPriorityAction deliverableShfrmPriorityActionAdd = deliverableShfrmPriorityActionPhase; + deliverableShfrmPriorityActionAdd.setDeliverable(deliverableShfrmPriorityAction.getDeliverable()); + deliverableShfrmPriorityActionAdd.setPhase(phase); + deliverableShfrmPriorityActionAdd + .setShfrmPriorityAction(deliverableShfrmPriorityAction.getShfrmPriorityAction()); + deliverableShfrmPriorityActionDAO.save(deliverableShfrmPriorityActionAdd); + } else { + DeliverableShfrmPriorityAction deliverableShfrmPriorityActionAdd = new DeliverableShfrmPriorityAction(); + deliverableShfrmPriorityActionAdd.setDeliverable(deliverableShfrmPriorityAction.getDeliverable()); + deliverableShfrmPriorityActionAdd.setPhase(phase); + deliverableShfrmPriorityActionAdd + .setShfrmPriorityAction(deliverableShfrmPriorityAction.getShfrmPriorityAction()); + deliverableShfrmPriorityActionDAO.save(deliverableShfrmPriorityActionAdd); + } + } catch (Exception e) { + logger.error("error saving replication in DeliverableShfrmPriorityActionManagerImpl " + e); } if (phase.getNext() != null) { this.saveDeliverableShfrmPriorityActionPhase(phase.getNext(), deliverableId, deliverableShfrmPriorityAction); diff --git a/marlo-web/src/main/resources/custom/aicrra.properties b/marlo-web/src/main/resources/custom/aicrra.properties index 178b80b1d3..39d7874c77 100644 --- a/marlo-web/src/main/resources/custom/aicrra.properties +++ b/marlo-web/src/main/resources/custom/aicrra.properties @@ -934,7 +934,7 @@ deliverable.shfrmContribution.question.help=If you select yes, please make sure deliverable.shfrmContribution.narrative.reporting=Provide a short narrative on the contribution of this deliverable to the SHFRM deliverable.shfrmContribution.narrative.planning=Provide a short narrative on the expected contribution of this deliverable to the SHFRM deliverable.shfrmContribution.priorityAction=To which priority action of the SHFRM is this deliverable contributing to? -deliverable.shfrmContribution.priorityAction.help=Select a priority action +deliverable.shfrmContribution.priorityAction.help=Select a priority action and sub-action deliverable.shfrmContribution.subAction=To which specific sub-action of the SHFRM is this deliverable contributing to? deliverable.shfrmContribution.subAction.help=Select sub-action(s) deliverable.shfrmContribution.indicators.help=Soil Indicator(s): @@ -2682,7 +2682,7 @@ project.deliverable.generalInformation.year=Year of expected completion project.deliverable.generalInformation.justification=Status justification project.deliverable.generalInformation.outcome=Outcome project.deliverable.generalInformation.keyOutput=Performance Indicators -project.deliverable.generalInformation.keyOutput.help=If you select yes in SHFRM question, please make sure to select the SHFRM indicator +project.deliverable.generalInformation.keyOutput.help=If you select yes in SHFRM question, please make sure to select at least one SHFRM indicator project.deliverable.generalInformation.keyOutputNotice=If the indicator you are looking for is not listed, please ensure the indicator is mapped to this cluster by clicking here project.deliverable.generalInformation.keyOutputNotList1=Remember that you must to add cluster of activities project.deliverable.generalInformation.keyOutputNotList2=, then you will be able to select key outputs. diff --git a/marlo-web/src/main/resources/global.properties b/marlo-web/src/main/resources/global.properties index 2544cfd073..b5e8e367ea 100644 --- a/marlo-web/src/main/resources/global.properties +++ b/marlo-web/src/main/resources/global.properties @@ -937,7 +937,7 @@ deliverable.shfrmContribution.question.help=If you select yes, please make sure deliverable.shfrmContribution.narrative.reporting=Provide a short narrative on the contribution of this deliverable the SHFRM deliverable.shfrmContribution.narrative.planing=Provide a short narrative on the expected contribution of this deliverable the SHFRM deliverable.shfrmContribution.priorityAction=To which priority action of the SHFRM is this deliverable contributing to? -deliverable.shfrmContribution.priorityAction.help=Select a priority action +deliverable.shfrmContribution.priorityAction.help=Select a priority action and sub-action deliverable.shfrmContribution.subAction=To which specific sub-action of the SHFRM is this deliverable contributing to? deliverable.shfrmContribution.subAction.help=Select sub-action(s) deliverable.shfrmContribution.indicators.help=Soil Indicator(s): @@ -2773,7 +2773,7 @@ project.deliverable.generalInformation.year=Year of expected completion project.deliverable.generalInformation.justification=Status justification project.deliverable.generalInformation.outcome=Outcome project.deliverable.generalInformation.keyOutput=Key Output -project.deliverable.generalInformation.keyOutput.help=If you select yes in SHFRM question, please make sure to select the SHFRM indicator +project.deliverable.generalInformation.keyOutput.help=If you select yes in SHFRM question, please make sure to select at least one SHFRM indicator project.deliverable.generalInformation.keyOutputNotice=Click here to add or edit the list of contribution to performance indicators project.deliverable.generalInformation.keyOutputNotList1=Remember that you must to add cluster of activities project.deliverable.generalInformation.keyOutputNotList2=, then you will be able to select key outputs. diff --git a/marlo-web/src/main/webapp/WEB-INF/global/macros/deliverableMacros.ftl b/marlo-web/src/main/webapp/WEB-INF/global/macros/deliverableMacros.ftl index 54b052e100..b3d8fb0592 100644 --- a/marlo-web/src/main/webapp/WEB-INF/global/macros/deliverableMacros.ftl +++ b/marlo-web/src/main/webapp/WEB-INF/global/macros/deliverableMacros.ftl @@ -1581,7 +1581,7 @@ [#-- --] - ${(subActionItem.shfrmSubAction.name)!'null'} + ${(subActionItem.shfrmSubAction.composedName)!'null'}
[/#macro]