Example #1
0
        public static ClassPanoramaViewData Create(ClassDetails cClass, IList <StandardizedTestDetails> standardizedTests, ClassPanorama panorama,
                                                   IList <GradingScaleRange> gradingScaleRanges, IList <StudentDetailsInfo> classStudents, IList <int> selectedStudents, DateTime today)
        {
            var res = new ClassPanoramaViewData(cClass)
            {
                StandardizedTests             = standardizedTests.Select(x => StandardizedTestViewData.Create(x, x.Components, x.ScoreTypes)).ToList(),
                ClassDistributionSection      = ClassDistributionSectionViewData.Create(panorama.Grades, panorama.Absences, panorama.Infractions, gradingScaleRanges),
                StandardizedTestsStatsByClass = StandardizedTestStatsViewData.CreateForClass(panorama.StandardizedTests, standardizedTests),
                Students = new List <StudentStandardizedTestStats>()
            };

            classStudents = classStudents.OrderBy(x => x.FullName()).ToList();

            //Preparing students
            foreach (var student in classStudents)
            {
                var studentStats = StandardizedTestStatsViewData.CreateForStudent(student.Id, panorama.StandardizedTests, standardizedTests);
                var gradeAvg     = panorama.Grades?.FirstOrDefault(x => x.StudentId == student.Id)?.AverageGrade;
                var infractions  = panorama.Infractions?.FirstOrDefault(x => x.StudentId == student.Id)?.NumberOfInfractions;
                var absences     = panorama.Absences?.FirstOrDefault(x => x.StudentId == student.Id);

                res.Students.Add(StudentStandardizedTestStats.Create(student, gradeAvg, absences, infractions, studentStats));
            }

            if (selectedStudents == null || selectedStudents.Count == 0)
            {
                return(res);
            }

            var selected = panorama.StandardizedTests?.Where(x => selectedStudents.Contains(x.StudentId));

            res.SelectStandardizedTestsStats = StandardizedTestStatsViewData.CreateForClass(selected?.ToList(), standardizedTests);

            return(res);
        }
Example #2
0
        public static ClassDistributionSectionViewData Create(IList <StudentAverageGradeInfo> avgInfos, IList <ShortStudentAbsenceInfo> absenceInfos,
                                                              IList <ShortStudentInfractionsInfo> infractionInfos, IList <GradingScaleRange> gradingScaleRanges)
        {
            var res = new ClassDistributionSectionViewData();

            if (avgInfos != null)
            {
                res.GradeAverageDistribution = CreateGradeAvgViewData(avgInfos, gradingScaleRanges);
            }
            if (absenceInfos != null)
            {
                res.AbsencesDistribution = CreateAbsencesViewData(absenceInfos);
            }
            if (infractionInfos != null)
            {
                res.DisciplineDistribution = CreateInfractionViewData(infractionInfos);
            }

            return(res);
        }