diff --git a/CHANGELOG.md b/CHANGELOG.md index 36875ad6..13f1a253 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. ### New Features - Add ContributeAndFinalize to `ReplicateWorkflow`. (#574) +- Add check for ContributeAndFinalize in `ReplicatesService`. (#576) ### Bug Fixes - Prevent race condition on replicate update. (#568) ### Quality diff --git a/src/main/java/com/iexec/core/chain/IexecHubService.java b/src/main/java/com/iexec/core/chain/IexecHubService.java index d9978bb5..94b582fc 100644 --- a/src/main/java/com/iexec/core/chain/IexecHubService.java +++ b/src/main/java/com/iexec/core/chain/IexecHubService.java @@ -61,7 +61,7 @@ public IexecHubService(CredentialsService credentialsService, /** * Check if the task is defined onchain and * has the status {@link ChainTaskStatus#UNSET}. - * + * * @param chainDealId * @param taskIndex * @return true if the task is found with the status UNSET, false otherwise. @@ -74,10 +74,17 @@ public boolean isTaskInUnsetStatusOnChain(String chainDealId, int taskIndex) { || ChainTaskStatus.UNSET.equals(chainTask.get().getStatus()); } + + public boolean isTaskInCompletedStatusOnChain(String chainTaskId) { + return getChainTask(chainTaskId) + .filter(chainTask -> ChainTaskStatus.COMPLETED == chainTask.getStatus()) + .isPresent(); + } + /** * Check if a deal's contribution deadline * is still not reached. - * + * * @param chainDealId * @return true if deadline is not reached, false otherwise. */ @@ -90,7 +97,7 @@ public boolean isBeforeContributionDeadline(String chainDealId) { /** * Check if a deal's contribution deadline * is still not reached. - * + * * @param chainDeal * @return true if deadline is not reached, false otherwise. */ @@ -103,13 +110,13 @@ public boolean isBeforeContributionDeadline(ChainDeal chainDeal) { *

Get deal's contribution deadline date. The deadline * is calculated as follow: * start + maxCategoryTime * maxNbOfPeriods. - * + * *