public async Task <IActionResult> OnGetAsync() { MarkovModel = await MarkovModels.FindAsync(Id); if (MarkovModel == null) { return(NotFound()); } Context.Entry(MarkovModel).Reference(x => x.Assignment) .Query().Include(x => x.CourseClass) .Load(); Context.Entry(MarkovModel).Collection(x => x.States) .Query().Include(x => x.Snapshots) .Include(x => x.Transitions).Load(); GraphChart = GetGraphChart(); ReturnUrl = Url.Page("/Analysis/Markov/Details", new { Id, }); return(Page()); }
public Task <IEnumerable <Survey> > GetSurveys() { Context.Entry(Student).Collection(x => x.Surveys) .Load(); return(Task.FromResult(Student.Surveys.Skip(Step * Options.StepSize) .Take(Options.StepSize))); }
public async Task <IActionResult> OnGetAsync() { Assignment = await Assignments.FindAsync(Id); if (Assignment == null) { return(NotFound()); } Context.Entry(Assignment).Reference(x => x.CourseClass).Query() .Load(); Context.Entry(Assignment).Collection(x => x.Snapshots).Query() .Include(x => x.Survey) .Load(); Surveys = Assignment.Snapshots.Select(x => { Context.Entry(x.Survey).Collection(y => y.SurveyResponses).Query() .Include(y => y.Answer).Include(y => y.Question).Load(); return(x.Survey); }).ToList(); var students = Surveys.Select(x => x.Student).Distinct(); ViewData["Students"] = new SelectList(students, "Id", "Name"); return(Page()); }
public async Task <IActionResult> OnGetAsync() { Assignment = await Assignments.FindAsync(Id); if (Assignment == null) { return(NotFound()); } Snapshots = Assignment.Snapshots.Where(x => x.StudentId.Equals(StudentId)). Select(x => { Context.Entry(x).Reference(y => y.Student).Load(); Context.Entry(x).Reference(y => y.Report).Load(); if (x.Report.Type == SnapshotReport.SnapshotReportTypes.Success) { Context.Entry((SnapshotSuccessReport)x.Report).Collection(y => y.SnapshotMethods).Query() .Include(y => y.MethodDeclaration).Load(); } return(x); }).ToList(); if (Snapshots.Count == 0) { return(NotFound()); } Student = Snapshots.First().Student; Context.Entry(Assignment).Reference(x => x.Solution) .Query().Include(x => x.MethodDeclarations).Load(); return(Page()); }
public async Task <IActionResult> OnGetAsync() { Assignment = await PreAssignments.FindAsync(Id); if (Assignment == null) { return(NotFound()); } Context.Entry(Assignment).Reference(x => x.Solution).Query() .Include(x => x.MethodDeclarations).Load(); Context.Entry(Assignment).Reference(x => x.CourseClass).Load(); Context.Entry(Assignment).Reference(x => x.TestProject).Query() .Include(x => x.UnitTests).Load(); Context.Entry(Assignment).Reference(x => x.PreAssignmentReport).Load(); switch (Assignment.PreAssignmentReport.Type) { case PreAssignmentReport.PreAssignmentReportTypes.FailTestsFailure: Context.Entry((PreAssignmentFailTestsFailureReport)Assignment.PreAssignmentReport) .Collection(x => x.FailUnitTests).Load(); break; case PreAssignmentReport.PreAssignmentReportTypes.MissingMethodsFailure: Context.Entry((PreAssignmentMissingMethodsFailureReport)Assignment.PreAssignmentReport) .Collection(x => x.MissingMethodDeclarations).Load(); break; } return(Page()); }
public async Task <IActionResult> OnGetAsync() { Assignment = await Assignments.FindAsync(Id); if (Assignment == null) { return(NotFound()); } Context.Entry(Assignment).Reference(x => x.CourseClass).Query() .Load(); Context.Entry(Assignment).Collection(x => x.Snapshots).Query() .Include(x => x.Survey) .Load(); Surveys = Assignment.Snapshots.Select(x => { Context.Entry(x.Survey).Collection(y => y.SurveyResponses).Query() .Include(y => y.Answer).Include(y => y.Question).Load(); return(x.Survey); }).Where(x => x.StudentId.Equals(StudentId)).ToList(); if (Surveys.Count == 0) { return(NotFound()); } Student = Surveys.First().Student; return(Page()); }
public async Task <IActionResult> OnGetAsync() { Assignment = await Assignments.FindAsync(Id); if (Assignment == null) { return(NotFound()); } Context.Entry(Assignment).Collection(x => x.Snapshots) .Query().Include(x => x.Report).Load(); Options = new MarkovModelOptions(); return(Page()); }
public Task <IEnumerable <Assignment> > GetAssignments() { Context.Entry(Student).Collection(x => x.StudentCourseClasses) .Query().Include(x => x.Class) .ThenInclude(x => x.Assignments) .ThenInclude(x => x.Solution).Load(); var assignments = Student.StudentCourseClasses.SelectMany( x => x.Class.Assignments) .Skip(Step * Options.StepSize) .Take(Options.StepSize); return(Task.FromResult(assignments)); }
public async Task <IActionResult> OnGetAsync() { var survey = await Surveys.FindAsync(Id); if (survey == null || survey.IsCompleted) { return(NotFound()); } Context.Entry(survey).Reference(x => x.Student) .Query() .Include(x => x.StudentCourseClasses) .Load(); if (!survey.Student.Email.Equals(User.Identity.Name)) { return(RedirectToPage("/Account/AccessDenied")); } var questions = await SurveyQuestionsSet.ToListAsync(); foreach (var question in questions.Where(x => survey.Student.StudentCourseClasses.Any(y => y.CourseClassId.Equals(x.CourseClassId)))) { switch (question.Type) { case SurveyQuestion.SurveyQuestionTypes.Qualitative: SurveyResponses.Add(new SurveyResponse() { SurveyQuestionId = question.Id, Question = question, Answer = new SurveyAnswerQualitative(), }); break; case SurveyQuestion.SurveyQuestionTypes.Rate: SurveyResponses.Add(new SurveyResponse() { SurveyQuestionId = question.Id, Question = question, Answer = new SurveyAnswerRate(), }); break; default: throw new ArgumentOutOfRangeException(); } } return(Page()); }
public async Task <IActionResult> OnGetAsync() { Assignment = await Assignments.FindAsync(Id); if (Assignment == null) { return(NotFound()); } Context.Entry(Assignment).Reference(x => x.CourseClass).Load(); Context.Entry(Assignment).Reference(x => x.Solution) .Query().Include(x => x.MethodDeclarations).Load(); Context.Entry(Assignment).Reference(x => x.TestProject) .Query().Include(x => x.UnitTests).Load(); return(Page()); }
public async Task <IActionResult> OnGetAsync() { Assignment = await Assignments.FindAsync(Id); if (Assignment == null) { return(NotFound()); } Context.Entry(Assignment).Reference(x => x.CourseClass).Query() .Load(); Context.Entry(Assignment).Collection(x => x.Snapshots).Query() .Include(x => x.Report) .Load(); return(Page()); }
public Task <IEnumerable <Snapshot> > GetSnapshots() { Context.Entry(Student).Collection(x => x.Snapshots) .Load(); return(Task.FromResult(Student.Snapshots .Skip(Step * Options.StepSize).Take(Options.StepSize) .Select(x => { Context.Entry(x) .Reference(y => y.Assignment) .Load(); Context.Entry(x) .Reference(y => y.Report) .Load(); return x; }))); }
public async Task <IActionResult> OnGetAsync() { Survey = await Surveys.FindAsync(Id); if (Survey == null) { return(NotFound()); } Context.Entry(Survey).Reference(x => x.Student).Load(); if (!Survey.Student.Email.Equals(User.Identity.Name)) { return(RedirectToPage("/Account/AccessDenied")); } return(Page()); }
public async Task <IActionResult> OnGetAsync() { Assignment = await Assignments.FindAsync(Id); if (Assignment == null) { return(NotFound()); } Context.Entry(Assignment).Reference(x => x.CourseClass).Query() .Load(); Context.Entry(Assignment).Reference(x => x.Solution) .Query().Include(x => x.MethodDeclarations).Load(); Context.Entry(Assignment).Collection(x => x.Snapshots).Query() .Include(x => x.Report) .Load(); LatestSnapshots = Assignment.Snapshots.Where(x => x.Report.Type == SnapshotReport.SnapshotReportTypes.Success) .GroupBy( s => s.StudentId, s => s, (key, g) => new { StudentId = key, Snapshots = g.ToList() }) .Select(x => { return(x.Snapshots.OrderBy(y => y.SnapshotSubmission.CreatedDateTime).Last()); }) .Select(x => { Context.Entry((SnapshotSuccessReport)x.Report).Collection(y => y.SnapshotMethods).Query() .Include(y => y.CodeAnalysisMetric) .ThenInclude(y => y.BagOfWordsMetric).Load(); return(x); }).ToList(); var students = LatestSnapshots.Select(x => x.Student).Distinct(); ViewData["Students"] = new SelectList(students, "Id", "Name"); return(Page()); }
public async Task <IActionResult> OnGetAsync() { Student = await Students.SingleOrDefaultAsync(x => x.Email.Equals(User.Identity.Name)); if (Student == null) { return(NotFound()); } Assignment = await Assignments.FindAsync(Id); if (Assignment == null) { return(NotFound()); } Snapshots = Student.Snapshots.Where(x => x.AssignmentId.Equals(Id)) .Select(x => { Context.Entry(x).Reference(y => y.Report).Load(); if (x.Report.Type != SnapshotReport.SnapshotReportTypes.Success) { return(x); } Context.Entry((SnapshotSuccessReport)x.Report) .Collection(y => y.SnapshotMethods) .Query().Include(y => y.MethodDeclaration).Load(); Context.Entry((SnapshotSuccessReport)x.Report) .Collection(y => y.UnitTestResults) .Query().Include(y => y.UnitTest) .Load(); return(x); }) .OrderByDescending(x => x.SnapshotSubmission.CreatedDateTime) .ToList(); return(Page()); }
public async Task <IActionResult> OnGetAsync() { Snapshot = await Snapshots.FindAsync(Id); if (Snapshot == null) { return(NotFound()); } Context.Entry(Snapshot) .Reference(x => x.Student).Load(); if (!Snapshot.Student.Email.Equals(User.Identity.Name)) { return(RedirectToPage("/Account/AccessDenied")); } Context.Entry(Snapshot) .Reference(x => x.Assignment).Load(); Context.Entry(Snapshot) .Reference(x => x.Report).Load(); if (Snapshot.Report.Type != SnapshotReport.SnapshotReportTypes.Success) { return(Page()); } Context.Entry((SnapshotSuccessReport)Snapshot.Report) .Collection(x => x.SnapshotMethods) .Query().Include(x => x.MethodDeclaration).Load(); Context.Entry((SnapshotSuccessReport)Snapshot.Report) .Collection(x => x.UnitTestResults) .Query().Include(x => x.UnitTest) .Load(); return(Page()); }
public async Task <IActionResult> OnGetAsync() { MarkovModel = await MarkovModels.FindAsync(Id); if (MarkovModel == null) { return(NotFound()); } Context.Entry(MarkovModel).Reference(x => x.Assignment) .Query().Load(); return(Page()); }
public async Task <IActionResult> OnGetAsync(string returnUrl) { Snapshot = await Snapshots.FindAsync(Id); if (Snapshot == null) { return(NotFound()); } ReturnUrl = returnUrl; Context.Entry(Snapshot) .Reference(x => x.Student).Load(); Context.Entry(Snapshot) .Reference(x => x.Assignment).Load(); Context.Entry(Snapshot) .Reference(x => x.Report).Load(); if (Snapshot.Report.Type != SnapshotReport.SnapshotReportTypes.Success) { return(Page()); } Context.Entry((SnapshotSuccessReport)Snapshot.Report) .Collection(x => x.SnapshotMethods) .Query().Include(x => x.MethodDeclaration).Load(); Context.Entry((SnapshotSuccessReport)Snapshot.Report) .Collection(x => x.UnitTestResults) .Query().Include(x => x.UnitTest) .Load(); return(Page()); }
public async Task <IActionResult> OnGetAsync() { CourseClass = await CourseClasses.FindAsync(Id); if (CourseClass == null) { return(NotFound()); } Context.Entry(CourseClass) .Collection(x => x.SurveyQuestions) .Load(); return(Page()); }
public async Task <IActionResult> OnGetAsync() { CourseClass = await CourseClasses.FindAsync(Id); if (CourseClass == null) { return(NotFound()); } Context.Entry(CourseClass).Collection(x => x.StudentCourseClasses) .Query().Include(x => x.Student) .ThenInclude(x => x.StudentCourseClasses) .ThenInclude(x => x.Class).Load(); return(Page()); }
public async Task <IActionResult> OnGetAsync() { CourseClass = await CourseClasses.FindAsync(Id); if (CourseClass == null) { return(NotFound()); } Context.Entry(CourseClass).Collection(x => x.Assignments).Query() .Include(x => x.TestProject).ThenInclude(x => x.UnitTests) .Include(x => x.Solution).ThenInclude(x => x.MethodDeclarations) .Load(); return(Page()); }
public async Task <IActionResult> OnGetAsync() { CourseClass = await CourseClasses.FindAsync(Id); if (CourseClass == null) { return(NotFound()); } Context.Entry(CourseClass) .Collection(x => x.PreAssignments) .Query().Include(x => x.Solution) .Include(x => x.PreAssignmentReport) .Load(); return(Page()); }
public async Task <IActionResult> OnPostCreateAsync() { if (!ModelState.IsValid) { return(Page()); } var course = await CourseClasses.FindAsync(Id); if (course == null) { return(NotFound()); } Context.Entry(course).Collection(x => x.PreAssignments).Load(); PreAssignment.PreAssignmentReport = new PreAssignmentPendingReport(); var testProject = FileHelper.ProcessFormFile(TestProjectFiles, ModelState); var solution = FileHelper.ProcessFormFile(SolutionFiles, ModelState); if (!ModelState.IsValid) { return(Page()); } PreAssignment.TestProject.Files = testProject; PreAssignment.Solution.Files = solution; course.PreAssignments.Add(PreAssignment); CourseClasses.Update(course); await Context.SaveChangesAsync(); var id = PreAssignment.Id; EngineService.RunPreAssignment(id); return(RedirectToPage("/PendingAssignments/Index", new { Id })); }
public async Task Delete(MarkovModel markovModel) { Context.Entry(markovModel).Collection(x => x.States).Query() .Include(x => x.Snapshots) .Include(x => x.Transitions).Load(); foreach (var state in markovModel.States) { foreach (var transition in state.Transitions) { Context.Remove(transition); } foreach (var snapshot in state.Snapshots) { Context.Remove(snapshot); } Context.Remove(state); } Context.Remove(markovModel); await Context.SaveChangesAsync(); }
public async Task <IActionResult> OnPostAsync() { CourseClass = await CourseClasses.FindAsync(Id); if (CourseClass == null) { return(NotFound()); } if (!ModelState.IsValid) { return(Page()); } Context.Entry(CourseClass) .Collection(x => x.SurveyQuestions) .Load(); CourseClass.SurveyQuestions.Add(Question); CourseClasses.Update(CourseClass); await Context.SaveChangesAsync(); return(RedirectToPage("/Questions/Index", new { Id })); }
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()); }