public CallForSpeechScoringResult Evaluate(CallForSpeech speechCandidate) { var brokenRules = this.rejectrules .Where(r => !r.IsSatisfiedBy(speechCandidate)) .ToList(); if (brokenRules.Any()) { return(CallForSpeechScoringResult.Red (brokenRules.Select(r => r.Message). ToArray())); } var warringrules = this.warringrules .Where(r => !r.IsSatisfiedBy(speechCandidate)) .ToList(); if (warringrules.Any()) { return(CallForSpeechScoringResult.Yellow (brokenRules.Select(r => r.Message). ToArray())); } return(CallForSpeechScoringResult.Green()); }
Run(CallForSpeech callForSpeech) { var temp = _mapper.Map <CallForSpeechTemp>(callForSpeech); using var connection = new SqliteConnection(_geekLemonContext.ConnectionString); var q = SqlQueries.CallForSpeechInsert; try { var result = await connection.QueryAsync <int>(q, temp); int createdId = result.FirstOrDefault(); CallForSpeechIds ids = new CallForSpeechIds() { CreatedId = new CallForSpeechId(createdId), UniqueId = callForSpeech.UniqueId }; return(ExecutionStatus <CallForSpeechIds> .DbOk(ids)); } catch (Exception ex) { if (ExecutionFlow.Options.ThrowExceptions) { throw; } return(ExecutionStatus <CallForSpeechIds> .DbError(ex)); } }
public CallForSpeech Build() { var cfs = new CallForSpeech ( callForSpeechNumber, speech, speaker, category ); if (targetStatus == CallForSpeechStatus.EvaluatedByMachine) { cfs.Evaluate(scoringRulesFactory.DefaultSet); } if (targetStatus == CallForSpeechStatus.PreliminaryAcceptedByJudge) { cfs.Evaluate(scoringRulesFactory.DefaultSet); cfs.PreliminaryAccept(judge); } if (targetStatus == CallForSpeechStatus.AcceptedByJudge) { cfs.Evaluate(scoringRulesFactory.DefaultSet); cfs.PreliminaryAccept(judge); cfs.Accept(judge); } if (targetStatus == CallForSpeechStatus.Rejected) { cfs.Reject(judge); } return(cfs); }
public void Accepted(CallForSpeech cc) { var c = new CallForSpeechAcceptedEvent (cc.Speaker, cc.Speech, cc.Registration, cc.Number, cc.Category, cc.Status, cc.ScoreResult, cc.PreliminaryDecision, cc.FinalDecision, cc.UniqueId, cc.Version); this.Key = c.UniqueId.GetAggregateKey(); ApplyChange(c); }
public Task <ExecutionStatus <CallForSpeechIds> > SubmitAsync(CallForSpeech callForSpeech) { return(_callForSpeechSubmitDoer.Run(callForSpeech)); }
public bool IsSatisfiedBy(CallForSpeech cfs) { return(cfs.Speaker.AgeInYearsAt(AppTime.Now()) < 70.Years()); }
public bool IsSatisfiedBy(CallForSpeech cfs) { return(cfs.Speaker.SpeakerWebsites.HaveSocialMedia()); }
public bool IsSatisfiedBy(CallForSpeech cfs) { return(cfs.Speaker.SpeakerWebsites.HaveGitHub() || cfs.Speaker.SpeakerWebsites.HaveBlog()); }
public static CallForSpeechAssert Should(this CallForSpeech cfs) => new CallForSpeechAssert(cfs);