public async Task <IActionResult> OnGetAsync(string selected) { Selected = selected; var indices = selected.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList(); if (selected.Length < 2) { return(NotFound()); } var institutionalId = Context.Users.Single(u => u.Email.Equals(User.Identity.Name)).InstitutionId; var assignments = (await Context.GetAssignmentsAsync()).Where(a => a.InstitutionId.Equals(institutionalId)).ToList(); foreach (var index in indices) { if (index >= 0 && index < assignments.Count) { Assignments.Add(assignments[index]); } } if (assignments.Count < 2) { return(NotFound()); } Instructors = Assignments.First().Instructors.ToList().Select(a => a.Instructor.Id).ToList(); Chart = GetChart(); return(Page()); }
public GroupBarChart GetChart() { var chart = new GroupBarChart() { Id = "overall", Minimum = 0, Maximum = 100, Colors = new List <string>() { RandomColor(), RandomColor(), RandomColor(), RandomColor(), }, Groups = Assignments.Select(x => $"{x.Name} {x.Course.CourseName}").ToList(), SubGroups = new List <string>() { "Line", "Branch", "Conditional", "Redundancies", }, Values = Assignments.Select(GetAssignmentAverages).ToList() }; return(chart); }