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)); }
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); }
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))); }
public static PersonProfilePanoramaSettingViewData Create(StudentProfilePanoramaSetting settings) { return(new PersonProfilePanoramaSettingViewData(settings)); }
protected PersonProfilePanoramaSettingViewData(StudentProfilePanoramaSetting settings) : base(settings.AcadYears, settings.StandardizedTestFilters) { }
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) }); }