public DonutChart GetOverallBuildChart() { var success = MarkovSnapshots.Count(x => x.Report.Type == Data.Models.SnapshotReport.SnapshotReportTypes.Success); var failure = MarkovSnapshots.Count(x => x.Report.Type == Data.Models.SnapshotReport.SnapshotReportTypes.Failure); return(new DonutChart() { Id = "assignment_overall_builds", Colors = new List <string>() { Constants.DataVisualConstants.PassedColor, Constants.DataVisualConstants.FailedColor }, Values = new List <int>() { success, failure }, Text = $"{Math.Floor((double)success / (success + failure) * 100):F0}%" }); }
public async Task <IActionResult> OnGetAsync() { MarkovModel = await MarkovModels.FindAsync(Id); if (MarkovModel == null || !MarkovModel.Finished) { return(NotFound()); } Context.Entry(MarkovModel).Reference(x => x.Assignment) .Query().Include(x => x.CourseClass) .Include(x => x.TestProject).ThenInclude(x => x.UnitTests) .Load(); Context.Entry(MarkovModel).Collection(x => x.States) .Query().Include(x => x.Snapshots) .Include(x => x.Transitions).Load(); MarkovModelState = MarkovModel.States.FirstOrDefault(x => x.Number.Equals(State)); if (MarkovModelState == null) { return(NotFound()); } ReturnUrl = Url.Page("/Analysis/Markov/State", new { Id, State, }); MarkovModelState.Snapshots.ToList() .ForEach(x => MarkovSnapshots .Add(Snapshots .Include(y => y.SnapshotSubmission) .Include(y => y.Student) .Include(y => y.Survey) .Include(y => y.Report) .FirstOrDefault(y => y.Id.Equals(x.SnapshotId)))); DeletedSnapshots = MarkovSnapshots.Count(x => MarkovModelState .Snapshots.All(y => !y.SnapshotId.Equals(x.Id))); Surveys = MarkovSnapshots.Select(x => { Context.Entry(x.Survey).Collection(y => y.SurveyResponses).Query() .Include(y => y.Answer).Include(y => y.Question).Load(); return(x.Survey); }).ToList(); SuccessfulSnapshots = MarkovSnapshots.Where(x => x.Report.Type.Equals(SnapshotReport.SnapshotReportTypes.Success)) .Select(x => { Context.Entry((SnapshotSuccessReport)x.Report).Collection(y => y.UnitTestResults).Query() .Include(y => y.UnitTest).Load(); return(x); }).ToList(); return(Page()); }