Skip to content

Commit

Permalink
Still allow completed records to be deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Howes committed Sep 10, 2021
1 parent ff0dd60 commit b6fbecb
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,23 +243,6 @@ public async Task ThenTheAgreementIsCheckedToSeeIfItHasBeenSignedAndHasActiveCom
Assert.ThrowsAsync<InvalidRequestException>(() => _handler.Handle(_command));
}

[Test]
public async Task ThenTheAgreementIsCheckedToSeeIfItHasBeenSignedAndHasCompletedCommitments()
{
_commitmentsApi
.Setup(x => x.GetEmployerAccountSummary(ExpectedAccountId))
.ReturnsAsync(new List<ApprenticeshipStatusSummary>
{
new ApprenticeshipStatusSummary
{
CompletedCount = 1,
LegalEntityIdentifier = _expectedAgreement.LegalEntityCode
}
});

Assert.ThrowsAsync<InvalidRequestException>(() => _handler.Handle(_command));
}

[Test]
public async Task ThenTheAgreementIsCheckedToSeeIfItHasBeenSignedAndHasWithdrawnCommitments()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private async Task ValidateLegalEntityHasNoCommitments(EmployerAgreementView agr
&& c.LegalEntityIdentifier.Equals(agreement.LegalEntityCode)
&& c.LegalEntityOrganisationType == agreement.LegalEntitySource);

if (commitment != null && (commitment.ActiveCount + commitment.PausedCount + commitment.PendingApprovalCount + commitment.CompletedCount + commitment.WithdrawnCount) != 0)
if (commitment != null && (commitment.ActiveCount + commitment.PausedCount + commitment.PendingApprovalCount + commitment.WithdrawnCount) != 0)
{
validationResult.AddError(nameof(agreement.HashedAgreementId), "Agreement has already been signed and has active commitments");
throw new InvalidRequestException(validationResult.ValidationDictionary);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ private async Task<bool> SetRemovedStatusBasedOnCommitments(long accountId, Acco

return commitmentConnectedToEntity == null || (commitmentConnectedToEntity.ActiveCount +
commitmentConnectedToEntity.PendingApprovalCount +
commitmentConnectedToEntity.CompletedCount +
commitmentConnectedToEntity.WithdrawnCount +
commitmentConnectedToEntity.PausedCount) == 0;
}
Expand Down

0 comments on commit b6fbecb

Please sign in to comment.