Пример #1
0
        public AllSpecializedResults GetResults(IEnumerable <User> users, int[] selectedCurriculumIds, ILmsService lmsServiceParam)
        {
            this.lmsService = lmsServiceParam;
            var asr = new AllSpecializedResults
            {
                Users = users.ToList(),
                // SelectedDisciplineIds = selectedCurriculumIds,
                Curriculums =
                    this.lmsService.FindService <ICurriculumService>().GetCurriculums(
                        curr => selectedCurriculumIds.Contains(curr.Id))
            };


            foreach (var usr in asr.Users)
            {
                var specializedResult = new SpecializedResult
                {
                    Curriculums = asr.Curriculums
                };

                foreach (var curriculum in specializedResult.Curriculums)
                {
                    var disciplineResult = new DisciplineResult
                    {
                        CurriculumChapterTopics =
                            this.lmsService.FindService <ICurriculumService>().GetCurriculumChapterTopicsByCurriculumId(curriculum.Id)
                    };

                    #region TopicResult

                    foreach (var curriculumChapterTopic in disciplineResult.CurriculumChapterTopics)
                    {
                        var topicResult = new TopicResult(usr, curriculumChapterTopic)
                        {
                            AttemptResults =
                                this.lmsService.FindService <ITestingService>().GetResults(
                                    usr, curriculumChapterTopic)
                        };
                        topicResult.Res = topicResult.GetTopicResultScore(lmsServiceParam);
                        disciplineResult.TopicResults.Add(topicResult);
                    }

                    #endregion

                    disciplineResult.CalculateSumAndMax(usr, curriculum);
                    specializedResult.DisciplineResults.Add(disciplineResult);
                }
                specializedResult.CalculateSpecializedResult(usr);
                asr.SpecializedResults.Add(specializedResult);
            }
            return(asr);
        }
Пример #2
0
        public AllSpecializedResults GetResults(IEnumerable<User> users, int[] selectedCurriculumIds, ILmsService lmsServiceParam)
        {
            this.lmsService = lmsServiceParam;
            var asr = new AllSpecializedResults
                {
                    Users = users.ToList(),
                    // SelectedDisciplineIds = selectedCurriculumIds,
                    Curriculums =
                        this.lmsService.FindService<ICurriculumService>().GetCurriculums(
                            curr => selectedCurriculumIds.Contains(curr.Id))
                };


            foreach (var usr in asr.Users)
            {
                var specializedResult = new SpecializedResult
                    {
                        Curriculums = asr.Curriculums
                    };

                foreach (var curriculum in specializedResult.Curriculums)
                {
                    var disciplineResult = new DisciplineResult
                        {
                            CurriculumChapterTopics =
                                this.lmsService.FindService<ICurriculumService>().GetCurriculumChapterTopicsByCurriculumId(curriculum.Id)
                        };

                    #region TopicResult

                    foreach (var curriculumChapterTopic in disciplineResult.CurriculumChapterTopics)
                    {
                        var topicResult = new TopicResult(usr, curriculumChapterTopic)
                            {
                                AttemptResults =
                                    this.lmsService.FindService<ITestingService>().GetResults(
                                        usr, curriculumChapterTopic)
                            };
                        topicResult.Res = topicResult.GetTopicResultScore(lmsServiceParam);
                        disciplineResult.TopicResults.Add(topicResult);
                    }

                    #endregion

                    disciplineResult.CalculateSumAndMax(usr, curriculum);
                    specializedResult.DisciplineResults.Add(disciplineResult);
                }
                specializedResult.CalculateSpecializedResult(usr);
                asr.SpecializedResults.Add(specializedResult);
            }
            return asr;
        }
Пример #3
0
        public AllSpecializedResults GetResults(IEnumerable <User> users, int[] selectDisciplineIds, ILmsService ILMS)
        {
            _LmsService = ILMS;
            AllSpecializedResults asr = new AllSpecializedResults();
            SpecializedResult     specializedResult;
            DisciplineResult      curRes;
            TopicResult           topicResult;


            asr.Users = users.ToList();
            asr.SelectDisciplineIds = selectDisciplineIds;
            asr.Disciplines         = _LmsService.FindService <ICurriculumService>().GetDisciplines(selectDisciplineIds);

            IEnumerable <int> ieIds = selectDisciplineIds;

            foreach (User usr in asr.Users)
            {
                specializedResult             = new SpecializedResult();
                specializedResult.Disciplines = _LmsService.FindService <ICurriculumService>().GetDisciplines(ieIds);
                foreach (Discipline curr in specializedResult.Disciplines)
                {
                    curRes        = new DisciplineResult();
                    curRes.Topics = _LmsService.FindService <ICurriculumService>().GetTopicsByDisciplineId(curr.Id);

                    #region TopicResult

                    foreach (Topic topic in curRes.Topics)
                    {
                        topicResult = new TopicResult(usr, topic);
                        topicResult.AttemptResults = _LmsService.FindService <ITestingService>().GetResults(usr, topic);
                        topicResult.Res            = topicResult.GetTopicResultScore();
                        curRes.TopicResult.Add(topicResult);
                    }

                    #endregion

                    curRes.CalculateSumAndMax(usr, curr);
                    specializedResult.DisciplineResult.Add(curRes);
                }
                specializedResult.CalculateSpecializedResult(usr);
                asr.SpecializedResult.Add(specializedResult);
            }
            return(asr);
        }
Пример #4
0
        public AllSpecializedResults GetResults(IEnumerable<User> users, int[] selectDisciplineIds, ILmsService ILMS)
        {
            _LmsService = ILMS;
            AllSpecializedResults asr = new AllSpecializedResults();
            SpecializedResult specializedResult;
            DisciplineResult curRes;
            TopicResult topicResult;

            
            asr.Users = users.ToList();
            asr.SelectDisciplineIds = selectDisciplineIds;
            asr.Disciplines = _LmsService.FindService<ICurriculumService>().GetDisciplines(selectDisciplineIds);

            IEnumerable<int> ieIds = selectDisciplineIds;
            foreach (User usr in asr.Users)
            {
                specializedResult = new SpecializedResult();
                specializedResult.Disciplines = _LmsService.FindService<ICurriculumService>().GetDisciplines(ieIds);
                foreach (Discipline curr in specializedResult.Disciplines)
                {
                    curRes = new DisciplineResult();
                    curRes.Topics = _LmsService.FindService<ICurriculumService>().GetTopicsByDisciplineId(curr.Id);
                    
                    #region TopicResult

                    foreach (Topic topic in curRes.Topics)
                    {
                        topicResult = new TopicResult(usr, topic);
                        topicResult.AttemptResults = _LmsService.FindService<ITestingService>().GetResults(usr, topic);
                        topicResult.Res = topicResult.GetTopicResultScore();
                        curRes.TopicResult.Add(topicResult);
                    }

                    #endregion

                    curRes.CalculateSumAndMax(usr, curr);
                    specializedResult.DisciplineResult.Add(curRes);
                }
                specializedResult.CalculateSpecializedResult(usr);
                asr.SpecializedResult.Add(specializedResult);
            }
            return asr;
        }
Пример #5
0
        public void CalculateSpecializedResultTest()
        {
            User usr = new User() { Username = "******" };
            Topic thm = new Topic() { Name = "Topic One" };
            AttemptResult AR = new AttemptResult(1, usr, thm, CompletionStatus.Completed, AttemptStatus.Completed, SuccessStatus.Passed, DateTime.Now, 0.5f);

            TopicResult topicRes = new TopicResult(usr, thm);
            List<AttemptResult> ARL = new List<AttemptResult>();
            ARL.Add(AR);
            topicRes.AttemptResults = ARL;
            topicRes.GetTopicResultScore();

            DisciplineResult currRes = new DisciplineResult();
            currRes.TopicResult.Add(topicRes);
            Discipline curr = null;
            currRes.CalculateSumAndMax(usr, curr);

            SpecializedResult target = new SpecializedResult();
            target.DisciplineResult.Add(currRes);
            target.CalculateSpecializedResult(usr);

            double? ExpectedSum = 50.0;
            double? ExpectedMax = 100.0;
            double? ExpectedPercent = 50.0;
            char ExpextedECTS = 'F';

            Assert.AreEqual(ExpectedSum, target.Sum);
            Assert.AreEqual(ExpectedMax, target.Max);
            Assert.AreEqual(ExpectedPercent, target.Percent);
            Assert.AreEqual(ExpextedECTS, target.ECTS);
        }