public Task <ResultsEngineStatuses> Process(ITeamResultEngineContext context, IResultsEngineRequest request, ResultsEngineResponse response) { if (context.Fixture.IsMatchPending(request.MatchID)) { response.ValidationResult.Errors.Add(new ValidationFailure("MatchStatus", "Match is pending. To make changes you will need to confirm the match details first.")); } if (context.Fixture.IsMatchProcessed(request.MatchID)) { response.ValidationResult.Errors.Add(new ValidationFailure("MatchStatus", "Match has already been processed. To make changes you will need to revert this match first.")); } return(ResultEngineStatusMapper.MapFromValidationResult(response.ValidationResult)); }
public Task <ResultsEngineStatuses> Process(ITeamResultEngineContext context, IGameResults request, ResultsEngineResponse response) { var processors = new List <IProcessor <ITeamResultEngineContext, IGameResults, ResultsEngineResponse> >(); processors.Add(this._singleClubRuleProcessor); processors.Add(this._singleTeamRuleProcessor); processors.Add(this._singleGamePerMatchGameNumber); processors.Add(this._checkTiedToTeam); processors.Add(this._checkMaximumGamesForHigherRankedTeamPerCompetitionProcessor); processors.Add(this._checkMaximumGamesForHigherRankedCompetitionProcessor); processors.Add(this._checkMaximumGamesForHigherRankedTeamAnyCompetition); this._processorExecutor.Execute(context, request, response, processors, true); return(ResultEngineStatusMapper.MapFromValidationResult(response.ValidationResult)); }
public async Task <ResultsEngineStatuses> Process(ITeamResultEngineContext context, IResultsEngineRequest request, ResultsEngineResponse response) { var match = await context.Fixture.GetMatch(request.MatchID); var matchCalculationConfiguration = await match.GetMatchCalculationEngineConfiguration(); if (!matchCalculationConfiguration.AllowDraw) { if (match.Data.IsDraw()) { response.ValidationResult.Errors.Add(new ValidationFailure("MatchResult", "Match has ended in a draw which is not allowed")); } } return(await ResultEngineStatusMapper.MapFromValidationResult(response.ValidationResult)); }