Пример #1
0
        public static GradeStudentViewData Create(Student person, bool?isWithDrawn)
        {
            var res = new GradeStudentViewData {
                StudentInfo = StudentViewData.Create(person), IsWithDrawn = isWithDrawn
            };

            res.StudentInfo.IsWithDrawn = isWithDrawn;
            return(res);
        }
Пример #2
0
        public static StandardGradingGridViewData Create(GradingPeriod gradingPeriod, IList <GradingStandardInfo> gradingStandardInfos, IList <Student> students)
        {
            var res = new StandardGradingGridViewData
            {
                GradingPeriod = GradingPeriodViewData.Create(gradingPeriod),
                Students      = students.Select(x => GradeStudentViewData.Create(x, x.IsWithdrawn)).ToList()
            };

            gradingStandardInfos = gradingStandardInfos.Where(x => students.Any(y => y.Id == x.StudentId) &&
                                                              gradingPeriod.Id == x.GradingPeriodId).ToList();
            res.GradingItems = StandardGradingViewData.Create(gradingStandardInfos, res.Students.Select(x => x.StudentInfo.Id).ToList());
            if (res.GradingItems.Count > 0)
            {
                res.Avg = (int?)res.GradingItems.Average(x => x.NumericAvg);
            }
            return(res);
        }
Пример #3
0
        public static GradingGridViewData Create(ChalkableGradeBook gradeBook, IList <ClaimInfo> claims)
        {
            var res = new GradingGridViewData(gradeBook)
            {
                Students = new List <GradeStudentViewData>()
            };

            if (gradeBook.Options != null)
            {
                res.DisplayAlphaGrades       = gradeBook.Options.DisplayAlphaGrades;
                res.DisplayStudentAverage    = gradeBook.Options.DisplayStudentAverage;
                res.DisplayTotalPoints       = gradeBook.Options.DisplayTotalPoints;
                res.IncludeWithdrawnStudents = gradeBook.Options.IncludeWithdrawnStudents;
                res.RoundDisplayedAverages   = gradeBook.Options.RoundDisplayedAverages;
            }
            foreach (var student in gradeBook.Students)
            {
                res.Students.Add(GradeStudentViewData.Create(student, student.IsWithdrawn));
            }
            var stIds = res.Students.Select(x => x.StudentInfo.Id).ToList();

            res.TotalAverages = StudentTotalAveragesViewData.Create(gradeBook.Averages, stIds);

            var gpAvg = res.TotalAverages.FirstOrDefault(x => x.IsGradingPeriodAverage);

            if (gpAvg != null)
            {
                res.Avg = gpAvg.TotalAverage;
            }

            if (res.DisplayTotalPoints || res.DisplayAlphaGrades)
            {
                BuildTotalPoints(res, stIds, gradeBook.StudentTotalPoints);
            }

            res.GradingItems = gradeBook.Announcements
                               .OrderByDescending(x => x.ClassAnnouncementData.Expires)
                               .Select(x => ShortAnnouncementGradeViewData.Create(x.ClassAnnouncementData, x.StudentAnnouncements, stIds, claims))
                               .ToList();

            return(res);
        }