Example #1
0
        public static StudentAttendanceSummaryViewData Create(StudentAttendanceSummary attendanceSummary, GradingPeriod currentGradingPeriod, IList <GradingPeriod> gradingPeriods
                                                              , IList <StudentCustomAlertDetail> customAlerts, IList <StudentHealthCondition> healthConditions, IList <StudentHealthFormInfo> healthForms)
        {
            var res = new StudentAttendanceSummaryViewData(attendanceSummary.Student, customAlerts, healthConditions, healthForms)
            {
                GradingPeriods = GradingPeriodViewData.Create(gradingPeriods)
            };

            if (currentGradingPeriod != null)
            {
                res.CurrentGradingPeriod = GradingPeriodViewData.Create(currentGradingPeriod);
            }

            decimal posibleDailyAttendanceCount = 0, dailyLates = 0, dailyAbsents = 0, dailyPresents = 0;

            if (attendanceSummary.DailyAttendanceSummary != null)
            {
                posibleDailyAttendanceCount = attendanceSummary.DailyAttendanceSummary.PosibleAttendanceCount;
                dailyLates    = attendanceSummary.DailyAttendanceSummary.Tardies ?? 0;
                dailyAbsents  = attendanceSummary.DailyAttendanceSummary.Absences ?? 0;
                dailyPresents = attendanceSummary.DailyAttendanceSummary.Presents ?? 0;
            }
            res.Absences = PrepareAttendanceBox(dailyAbsents, posibleDailyAttendanceCount, attendanceSummary.ClassAttendanceSummaries, x => x.Absences, 5);
            res.Lates    = PrepareAttendanceBox(dailyLates, posibleDailyAttendanceCount, attendanceSummary.ClassAttendanceSummaries, x => x.Tardies, 10);
            res.Presents = PrepareAttendanceBox(dailyPresents, posibleDailyAttendanceCount, attendanceSummary.ClassAttendanceSummaries, x => x.Presents, 0, true);
            return(res);
        }
Example #2
0
        private District PrepareCommonViewDataForSchoolPerson(StartupData startupData)
        {
            //TODO: render data for demo school
            var district = PrepareCommonViewData();

            ViewData[ViewConstants.UNSHOWN_NOTIFICATIONS_COUNT] = startupData.UnshownNotificationsCount;
            var           mps           = startupData.MarkingPeriods;
            MarkingPeriod markingPeriod = mps.Where(x => x.StartDate <= Context.NowSchoolYearTime).OrderBy(x => x.StartDate).LastOrDefault();

            if (markingPeriod != null && SchoolLocator.Context.SchoolLocalId.HasValue)
            {
                PrepareJsonData(MarkingPeriodViewData.Create(markingPeriod), ViewConstants.MARKING_PERIOD);
                var gradingPeriod = startupData.GradingPeriod;
                if (gradingPeriod != null)
                {
                    PrepareJsonData(ShortGradingPeriodViewData.Create(gradingPeriod), ViewConstants.GRADING_PERIOD);
                }
            }
            PrepareJsonData(AlphaGradeViewData.Create(startupData.AlphaGrades), ViewConstants.ALPHA_GRADES);
            PrepareJsonData(AlternateScoreViewData.Create(startupData.AlternateScores), ViewConstants.ALTERNATE_SCORES);
            PrepareJsonData(GradingPeriodViewData.Create(startupData.GradingPeriods), ViewConstants.GRADING_PERIODS);

            PrepareJsonData(MarkingPeriodViewData.Create(mps), ViewConstants.MARKING_PERIODS);
            var sy = SchoolLocator.SchoolYearService.GetCurrentSchoolYear();

            PrepareJsonData(SchoolYearViewData.Create(sy), ViewConstants.SCHOOL_YEAR);
            PrepareJsonData(SchoolLocator.SchoolYearService.GetYears(), ViewConstants.YEARS);

            return(district);
        }
Example #3
0
 public static GradingPeriodFinalGradeViewData Create(FinalGradeInfo finalGrade, ChalkableAverage average, IList <ClaimInfo> claims)
 {
     return(new GradingPeriodFinalGradeViewData
     {
         GradingPeriod = GradingPeriodViewData.Create(finalGrade.GradeBook.GradingPeriod),
         Averages = ShortAverageViewData.Create(finalGrade.Averages),
         CurrentAverage = average != null?ShortAverageViewData.Create(average) : null,
                              StudentFinalGrades = StudentFinalGradeViewData.Create(finalGrade, average, claims)
     });
 }
Example #4
0
        public ActionResult DistrictAdmin()
        {
            Trace.Assert(Context.PersonId.HasValue);
            Trace.Assert(Context.SchoolYearId.HasValue);

            var distictAdmin = SchoolLocator.PersonService.GetPersonDetails(Context.PersonId.Value);
            var district     = PrepareCommonViewData();

            ViewData[ViewConstants.ROLE_NAME] = CoreRoles.DISTRICT_ADMIN_ROLE.LoweredName;
            PrepareJsonData(PersonViewData.Create(distictAdmin), ViewConstants.CURRENT_PERSON);
            var gradeLevel = SchoolLocator.GradeLevelService.GetGradeLevels();

            PrepareJsonData(GradeLevelViewData.Create(gradeLevel), ViewConstants.GRADE_LEVELS);
            PrepareJsonData(AttendanceReasonDetailsViewData.Create(SchoolLocator.AttendanceReasonService.GetAll()), ViewConstants.ATTENDANCE_REASONS);

            var sy = SchoolLocator.SchoolYearService.GetCurrentSchoolYear();

            PrepareJsonData(SchoolYearViewData.Create(sy), ViewConstants.SCHOOL_YEAR);
            PrepareJsonData(SchoolLocator.SchoolYearService.GetYears(), ViewConstants.YEARS);

            var announcementAttributes = SchoolLocator.AnnouncementAttributeService.GetList(true);

            PrepareJsonData(AnnouncementAttributeViewData.Create(announcementAttributes), ViewConstants.ANNOUNCEMENT_ATTRIBUTES);

            var gradingPeriods       = SchoolLocator.GradingPeriodService.GetGradingPeriodsDetails(Context.SchoolYearId.Value);
            var currentGradingPeriod = SchoolLocator.GradingPeriodService.GetGradingPeriodDetails(Context.SchoolYearId.Value, Context.NowSchoolYearTime.Date);

            PrepareJsonData(GradingPeriodViewData.Create(gradingPeriods), ViewConstants.GRADING_PERIODS);
            PrepareJsonData(ShortGradingPeriodViewData.Create(currentGradingPeriod), ViewConstants.GRADING_PERIOD);

            var mps = SchoolLocator.MarkingPeriodService.GetMarkingPeriods(sy.Id);

            PrepareJsonData(MarkingPeriodViewData.Create(mps), ViewConstants.MARKING_PERIODS);

            var schoolOption = SchoolLocator.SchoolService.GetSchoolOption();

            PrepareJsonData(SchoolOptionViewData.Create(schoolOption), ViewConstants.SCHOOL_OPTIONS);

            var alternateScore = SchoolLocator.AlternateScoreService.GetAlternateScores();

            PrepareJsonData(AlternateScoreViewData.Create(alternateScore), ViewConstants.ALTERNATE_SCORES);

            var gradingComments = SchoolLocator.GradingCommentService.GetGradingComments();

            PrepareJsonData(GradingCommentViewData.Create(gradingComments), ViewConstants.GRADING_COMMMENTS);

            ViewData[ViewConstants.REPORT_CARDS_ENABLED] = MasterLocator.DistrictService.IsReportCardsEnabled();

            var ip = RequestHelpers.GetClientIpAddress(Request);

            MasterLocator.UserTrackingService.IdentifyDistrictAdmin(distictAdmin.Email, "", "",
                                                                    district.Name, null, Context.DistrictTimeZone, Context.Role.Name, ip, Context.SCEnabled);
            return(View());
        }
Example #5
0
        public static StudentDisciplineSummaryViewData Create(Student student, IList <InfractionSummaryInfo> infractionsSummary
                                                              , GradingPeriod currentGradingPeriod, IList <GradingPeriod> gradingPeriods, IList <StudentCustomAlertDetail> customAlerts
                                                              , IList <StudentHealthCondition> healthConditions, IList <StudentHealthFormInfo> healthForms)
        {
            string summary = $"{student.FirstName} is doing great. No discipline issues.";

            if (infractionsSummary.Sum(x => x.Occurrences) > 0)
            {
                summary = $"{student.FirstName} is having disciplinary issues";
            }
            var disciplineBoxes = infractionsSummary.Select(StudentDisciplineBoxViewData.Create).ToList();
            var res             = new StudentDisciplineSummaryViewData(student, customAlerts, healthConditions, healthForms)
            {
                CurrentGradingPeriod = GradingPeriodViewData.Create(currentGradingPeriod),
                Summary         = summary,
                DisciplineBoxes = disciplineBoxes,
                Gradingperiods  = GradingPeriodViewData.Create(gradingPeriods)
            };

            return(res);
        }