public ActionResult AssessmentGradeDistribution(Guid? id) { List<CourseTermMember> students = dataRepository.GetStudentsInCourseTerm(courseTerm); if (id == null) { return View("AssessmentNotFound"); } Assessment a = dataRepository.GetAssessmentByID(courseTerm, id.Value); GradeDistribution dist = new GradeDistribution(); foreach (var student in students) { Grade g = new Grade(a, student.Profile); if (g.SubmissionRecord != null) { dist.AddGrade(g.Percentage,student.Profile); } else { dist.AddGrade(new Nullable<double>(),student.Profile); } } AssessmentGradeDistributionModel model = new AssessmentGradeDistributionModel(); model.GradeDistribution = dist; model.Assessment = a; return View(model); }
public ActionResult Details(string siteShortName, string courseTermShortName) { Guid id = UserHelpers.GetCurrentUserID(); CourseTermMember member = dataRepository.GetCourseTermMemberByMembershipID(courseTerm,id); if (member != null) { if (member.AccessLevel == 1) //Student { CourseTermStudentDetailsViewModel model = new CourseTermStudentDetailsViewModel(); double grade = member.GetFinalGrade(); string gradeText = GradeHelpers.GetFormattedGrade(grade); model.CurrentGrade = gradeText; model.RecentMessages = dataRepository.GetRecentCourseTermMessages(courseTerm.CourseTermID); model.UpcomingAssessments = dataRepository.GetUpcomingAssessments(courseTerm); model.CourseTerm = courseTerm; return View("StudentDetails", model); } else if (member.AccessLevel > 1) //TA or Professor { CourseTermInstructorDetailsViewModel model = new CourseTermInstructorDetailsViewModel(); model.CourseTerm = courseTerm; List<CourseTermMember> students = dataRepository.GetStudentsInCourseTerm(courseTerm); GradeDistribution dist = new GradeDistribution(); foreach (var student in students) { dist.AddGrade(student.GetFinalGrade(), student.Profile); } model.GradeDistribution = dist; model.UngradedAssessments = dataRepository.GetUngradedAssessments(courseTerm); return View("InstructorDetails", model); } } return View(courseTerm); }
public ActionResult ClassGradeDistribution() { List<CourseTermMember> students = dataRepository.GetStudentsInCourseTerm(courseTerm); GradeDistribution dist = new GradeDistribution(); foreach (var student in students) { dist.AddGrade(student.GetFinalGrade(),student.Profile); } return View(dist); }