public static GradingClassSummaryItemViewData Create(IList <AnnouncementDetails> announcements,
                                                             GradedClassAnnouncementType announcementType, IList <ClaimInfo> claims)
        {
            var res = new GradingClassSummaryItemViewData
            {
                Percent       = announcementType.Percentage,
                Type          = ClassAnnouncementTypeViewData.Create(announcementType),
                Avg           = (decimal?)announcementType.Avg,
                Announcements = announcements.Select(x => ClassAnnouncementViewData.Create(x.ClassAnnouncementData, claims)).ToList()
            };

            return(res);
        }
        public static GradingClassSummaryViewData Create(IList <AnnouncementDetails> announcements,
                                                         GradingPeriod gradingPeriod, IList <GradedClassAnnouncementType> announcementTypes, double?avg, IList <ClaimInfo> claims)
        {
            var res = new GradingClassSummaryViewData
            {
                GradingPeriod       = GradingPeriodViewData.Create(gradingPeriod),
                Avg                 = (decimal?)avg,
                ByAnnouncementTypes = new List <GradingClassSummaryItemViewData>()
            };

            if (announcements != null && announcementTypes != null)
            {
                foreach (var gradedClassAnnouncementType in announcementTypes)
                {
                    var anns = announcements.Where(x => x.ClassAnnouncementData.ClassAnnouncementTypeRef == gradedClassAnnouncementType.Id).ToList();
                    res.ByAnnouncementTypes.Add(GradingClassSummaryItemViewData.Create(anns, gradedClassAnnouncementType, claims));
                }
            }
            return(res);
        }