Skip to content

Commit

Permalink
Update ExistingActorConsolidationService.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
FirestarJes committed Dec 27, 2024
1 parent 7793d69 commit ba594ef
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public async Task CheckExistingConsolidationAsync(ActorId fromActorId, ActorId t
.GetAsync()
.ConfigureAwait(false)).ToList();

if (existingConsolidations.Any(consolidation => consolidation.ActorFromId == fromActorId || consolidation.ActorToId == fromActorId))
if (existingConsolidations.Any(consolidation => consolidation.ActorFromId == fromActorId || (consolidation.ActorToId == fromActorId && consolidation.Status == ActorConsolidationStatus.Pending)))
{
throw new ValidationException("The specified From actor has already been consolidated before.")
throw new ValidationException("The specified From actor has already been consolidated before or is already scheduled to be consolidated in the future.")
.WithErrorCode("actor.consolidation.fromexists");
}

if (existingConsolidations.Any(consolidation => consolidation.ActorToId == fromActorId || consolidation.ActorFromId == toActorId))
if (existingConsolidations.Any(consolidation => consolidation.ActorFromId == toActorId))
{
throw new ValidationException("The specified From actor has an existing consolidation scheduled already.")
throw new ValidationException("The specified From actor has already been, or is, in an existing consolidation as the discontinued actor.")
.WithErrorCode("actor.consolidation.toexists");
}
}
Expand Down

0 comments on commit ba594ef

Please sign in to comment.