Exemple #1
0
        public static ClassPanorama Create(SectionPanorama model)
        {
            var classPanorama = new ClassPanorama();

            if (model.Absences != null)
            {
                classPanorama.Absences = model.Absences.Select(ShortStudentAbsenceInfo.Create).ToList();
            }

            if (model.Grades != null)
            {
                classPanorama.Grades = model.Grades.Select(StudentAverageGradeInfo.Create).ToList();
            }

            if (model.Infractions != null)
            {
                classPanorama.Infractions = model.Infractions.Select(ShortStudentInfractionsInfo.Create).ToList();
            }

            if (model.StandardizedTests != null)
            {
                classPanorama.StandardizedTests = model.StandardizedTests.Select(StudentStandardizedTestInfo.Create).ToList();
            }

            return(classPanorama);
        }
Exemple #2
0
        public void SectionPanoramaApiTest()
        {
            var connector     = ConnectorLocator.Create("MAGOLDEN-3856695863", "qqqq1111", "http://sandbox.sti-k12.com/chalkable/api/");
            var componentsIds = new List <int>
            {
                1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 6, 7, 7, 7, 7, 7, 7, 8, 10, 11, 12, 13, 14, 15
            };

            var scoreTypeIds = new List <int>
            {
                1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 11, 1, 2, 3, 4, 5, 6, 8, 12, 12, 12, 12, 12, 12
            };

            Debug.WriteLine($"{componentsIds.Count} - {scoreTypeIds.Count}");

            SectionPanorama callResult = new SectionPanorama();
            List <int>      classIds   = new List <int>
            {
                13770, 13771, 13772, 13806, 13861, 13862, 13950, 14011, 14436, 15165
            };

            bool found  = false;
            int  @class = 0;

            foreach (var classId in classIds)
            {
                callResult = connector.PanoramaConnector.GetSectionPanorama(classId, new List <int> {
                    179
                }, componentsIds, scoreTypeIds);
                if (callResult.StandardizedTests != null)
                {
                    found  = true;
                    @class = classId;
                    break;
                }
            }
            if (!found)
            {
                Debug.WriteLine("StandardizedTests not found in any class");
                return;
            }

            Debug.WriteLine($"ClassId : {@class}");
            Debug.WriteLine("Absences [StudentId - NumberOfAbsences - NumberOfDaysEnrolled]:");
            foreach (var studentAbsence in callResult.Absences)
            {
                Debug.WriteLine($"{studentAbsence.StudentId} - {studentAbsence.NumberOfAbsences} - {studentAbsence.NumberOfDaysEnrolled}");
            }

            Debug.WriteLine("Grades [StudentId - AvarageGrade]:");
            foreach (var grade in callResult.Grades)
            {
                Debug.WriteLine($"{grade.StudentId} - {grade.AverageGrade}");
            }

            Debug.WriteLine("Infractions [StudentId - NumberOfInfractions]:");
            foreach (var inf in callResult.Infractions)
            {
                Debug.WriteLine($"{inf.StudentId} - {inf.NumberOfInfractions}");
            }

            Debug.WriteLine("StandardizedTests [StudentId - Date - Score - StandardizedTestComponentId - StandardizedTestScoreTypeId]:");
            if (callResult.StandardizedTests != null)
            {
                foreach (var stTests in callResult.StandardizedTests)
                {
                    Debug.WriteLine($"{stTests.StudentId} - {stTests.Date} - {stTests.Score} - {stTests.StandardizedTestComponentId} - {stTests.StandardizedTestId} - {stTests.StandardizedTestScoreTypeId}");
                }
            }
        }