GetStatesForReinstatingAfterPossibleRetry(ReleaseStatus releaseStatus) { var startingState = releaseStatus.Immediate ? ReleaseStatusStates.ImmediateReleaseStartedState : ReleaseStatusStates.ScheduledReleaseStartedState; var existingState = releaseStatus.State; var publishingCancelled = existingState.Publishing == ReleaseStatusPublishingStage.Cancelled; var overallFailed = existingState.Overall == ReleaseStatusOverallStage.Failed; var contentOk = existingState.Content == ReleaseStatusContentStage.Complete || releaseStatus.Immediate && existingState.Content == startingState.Content; var filesOk = existingState.Files == ReleaseStatusFilesStage.Complete; var dataOk = existingState.Data == ReleaseStatusDataStage.Complete; var reinstate = publishingCancelled && overallFailed && contentOk && filesOk && dataOk; var newPublishingState = reinstate ? startingState.Publishing : existingState.Publishing; var newOverallState = reinstate ? startingState.Overall : existingState.Overall; return(newPublishingState, newOverallState); }
public async Task <ReleaseStatus> CreateAsync(Guid releaseId, ReleaseStatusState state, bool immediate, IEnumerable <ReleaseStatusLogMessage> logMessages = null) { var release = await GetReleaseAsync(releaseId); var table = await GetTableAsync(); var publish = immediate ? null : release.PublishScheduled; var releaseStatus = new ReleaseStatus(release.Publication.Slug, publish, release.Id, release.Slug, state, immediate, logMessages); var tableResult = await table.ExecuteAsync(TableOperation.Insert(releaseStatus)); return(tableResult.Result as ReleaseStatus); }