public static StudentProfileGradingSummaryViewData Create(Student student, IList <ChalkableStudentAverage> studentAverages, GradingPeriod currentGradingPeriod , IList <GradingPeriod> gradingPeriods, IList <Class> classes, IEnumerable <int> enrolledClassIds , IList <StudentCustomAlertDetail> customAlerts, IList <StudentHealthCondition> healthConditions , IList <StudentHealthFormInfo> healthForms) { var avgs = studentAverages.Where(x => enrolledClassIds.Contains(x.ClassId)).ToList(); var gradings = new List <StudentGradingsViewData>(); foreach (var gp in gradingPeriods) { var gpAvgs = avgs.Where(x => x.GradingPeriodId == gp.Id).ToList(); var classAvgs = gpAvgs.GroupBy(x => x.ClassId) .Select(x => StudentClassAvgViewData.Create(classes.First(y => y.Id == x.Key), x)); gradings.Add(new StudentGradingsViewData { GradingPeriod = GradingPeriodViewData.Create(gp), ClassAvgs = classAvgs.ToList() }); } return(new StudentProfileGradingSummaryViewData { Student = StudentProfileViewData.Create(student, customAlerts, healthConditions, healthForms), CurrentGradingPeriod = GradingPeriodViewData.Create(currentGradingPeriod), GradesByGradingPeriod = gradings.ToList() });; }
public async Task <ActionResult> Schedule(int personId) { var studentHealths = SchoolLocator.StudentService.GetStudentHealthConditions(personId); var syId = GetCurrentSchoolYearId(); var healthFormsTask = SchoolLocator.StudentService.GetStudentHealthForms(personId, syId); var student = SchoolLocator.StudentService.GetById(personId, GetCurrentSchoolYearId()); var customAlerts = SchoolLocator.StudentCustomAlertDetailService.GetList(personId); var res = PrepareScheduleData(StudentProfileViewData.Create(student, customAlerts, await studentHealths, await healthFormsTask)); return(Json(res)); }
protected StudentDisciplineSummaryViewData(Student student, IList <StudentCustomAlertDetail> customAlerts , IList <StudentHealthCondition> healthConditions, IList <StudentHealthFormInfo> healthForms) { Student = StudentProfileViewData.Create(student, customAlerts, healthConditions, healthForms); }