예제 #1
0
        public ActionResult SavePanoramaSettings(StudentProfilePanoramaSetting setting)
        {
            if (!Context.Claims.HasPermission(ClaimInfo.VIEW_PANORAMA))
            {
                throw new ChalkableSecurityException("You are not allowed to change panorama settings");
            }

            if (setting.AcadYears == null || setting.AcadYears.Count == 0)
            {
                throw new ChalkableException("Academic years is required parameter");
            }

            SchoolLocator.PanoramaSettingsService.Save(setting, null);
            return(Json(true));
        }
예제 #2
0
        private static StudentProfilePanoramaSetting GetDefaultStudentPanoramaSettings(IServiceLocatorSchool serviceLocator, int?classId)
        {
            var currentSchoolYear     = serviceLocator.SchoolYearService.GetCurrentSchoolYear();
            var adminPanoramaSettings = serviceLocator.PanoramaSettingsService.Get <AdminPanoramaSettings>(null);
            var previousSchoolYear    = serviceLocator.SchoolYearService.GetPreviousSchoolYears(currentSchoolYear.Id, adminPanoramaSettings.PreviousYearsCount);

            var res = new StudentProfilePanoramaSetting
            {
                AcadYears = previousSchoolYear.Select(x => x.AcadYear).ToList(),
                StandardizedTestFilters = adminPanoramaSettings.StudentDefaultSettings
                                          ?? new List <StandardizedTestFilter>()
            };

            res.AcadYears.Add(currentSchoolYear.AcadYear);

            return(res);
        }
예제 #3
0
        public async Task <ActionResult> Panorama(int studentId, StudentProfilePanoramaSetting settings)
        {
            if (!Context.Claims.HasPermission(ClaimInfo.VIEW_PANORAMA))
            {
                throw new ChalkableSecurityException("You are not allowed to view class panorama");
            }

            if (settings.AcadYears == null)
            {
                settings = SchoolLocator.PanoramaSettingsService.Get <StudentProfilePanoramaSetting>(null);
            }

            if (settings.AcadYears.Count == 0)
            {
                throw new ChalkableException("Academic years is required parameter");
            }

            var studentPanorama = await SchoolLocator.StudentService.Panorama(studentId, settings.AcadYears, settings.StandardizedTestFilters);

            var standardizedTests = SchoolLocator.StandardizedTestService.GetListOfStandardizedTestDetails();

            return(Json(StudentPanoramaViewData.Create(studentId, studentPanorama, settings, standardizedTests)));
        }
예제 #4
0
 public static PersonProfilePanoramaSettingViewData Create(StudentProfilePanoramaSetting settings)
 {
     return(new PersonProfilePanoramaSettingViewData(settings));
 }
예제 #5
0
 protected PersonProfilePanoramaSettingViewData(StudentProfilePanoramaSetting settings) : base(settings.AcadYears, settings.StandardizedTestFilters)
 {
 }
예제 #6
0
 public static StudentPanoramaViewData Create(int studentId, StudentPanoramaInfo panorama, StudentProfilePanoramaSetting settings, IList <StandardizedTestDetails> tests)
 {
     return(new StudentPanoramaViewData
     {
         StandardizedTestsStats = StandardizedTestStatsViewData.CreateForStudent(studentId, panorama.StandardizedTests, tests),
         Absences = panorama.DailyAbsences?.Select(StudentDailyAbsenceViewData.Create).OrderBy(x => x.Date).ToList(),
         DisciplineStats = panorama.Infractions?.Select(StudentInfractionViewData.Create).OrderBy(x => x.OccurrenceDate).ToList(),
         AttendanceStats = BuildAttendanceStats(panorama.DailyAbsences, panorama.AllSchoolDays),
         DailyDisciplineStats = BuildDisciplineStats(panorama.Infractions, panorama.AllSchoolDays),
         FilterSettings = settings,
         StandardizedTests = tests.Select(x => StandardizedTestViewData.Create(x, x.Components, x.ScoreTypes)).ToList(),
         Calendars = StudentPanoramaCalendarViewData.Create(panorama.DailyAbsences, panorama.Infractions, panorama.AllSchoolDays, panorama.SchoolYears)
     });
 }