コード例 #1
0
ファイル: AttemptResult.cs プロジェクト: supermuk/iudico
        public AttemptResult(long attemptId, User user, CurriculumChapterTopic curriculumChapterTopic, TopicTypeEnum topicType, CompletionStatus completionStatus, AttemptStatus attemptStatus, SuccessStatus successStatus, DateTime? startTime, DateTime? finishTime, int iudicoCourseRef, float? minScore, float? maxScore, float? rawScore, float? scaledScore)
        {
            this.AttemptId = attemptId;
            this.User = user;
            this.CurriculumChapterTopic = curriculumChapterTopic;
            this.TopicType = topicType;

            this.CompletionStatus = completionStatus;
            this.AttemptStatus = attemptStatus;
            this.SuccessStatus = successStatus;
            this.StartTime = startTime;
            this.FinishTime = finishTime;
            this.IudicoCourseRef = iudicoCourseRef;
            this.Score = new Score(minScore, maxScore, rawScore, scaledScore);
        }
コード例 #2
0
        public void SetUpFixture()
        {
            // defining mocks
            this.windsorContainerMock = new Mock <IWindsorContainer>();
            this.lmsServiceMock       = new Mock <LmsService>(this.windsorContainerMock.Object);

            this.userServiceMock       = new Mock <IUserService>();
            this.courseServiceMock     = new Mock <ICourseService>();
            this.curriculumServiceMock = new Mock <ICurriculumService>();

            this.mlcProxyMock = new Mock <IMlcProxy>();

            this.trainingController = new TrainingController(this.mlcProxyMock.Object);

            PluginController.LmsService = this.lmsServiceMock.Object;

            // setuping mocks
            this.mlcProxyMock.Setup(
                proxy => proxy.GetAttemptId(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <TopicTypeEnum>())).Returns(
                DummyAttemptId);

            this.windsorContainerMock.Setup(container => container.Resolve <IUserService>()).Returns(
                this.userServiceMock.Object);
            this.windsorContainerMock.Setup(container => container.Resolve <ICourseService>()).Returns(
                this.courseServiceMock.Object);
            this.windsorContainerMock.Setup(container => container.Resolve <ICurriculumService>()).Returns(
                this.curriculumServiceMock.Object);

            this.dummyCurriculumChapterTopic = new CurriculumChapterTopic
            {
                Id = DummyCurriculumChapterTopicId, Topic = new Topic {
                    Name = "C++ Testing"
                }
            };
            this.dummyCourse = new Course {
                Id = DummyCourseId
            };
            this.dummyUser = new User();
        }
コード例 #3
0
        public int AddCurriculumChapter(CurriculumChapter curriculumChapter)
        {
            var db = this.GetDbContext();

            curriculumChapter.IsDeleted = false;

            db.CurriculumChapters.InsertOnSubmit(curriculumChapter);

            var curriculum = GetCurriculum(db, curriculumChapter.CurriculumRef);

            if (curriculumChapter.StartDate < curriculum.StartDate || curriculumChapter.EndDate > curriculum.EndDate)
            {
                curriculum.IsValid = false;
            }

            db.SubmitChanges();

            // add corresponding curriculum chapter topics
            var topics = this.GetTopicsByChapterId(curriculumChapter.ChapterRef);

            foreach (var topic in topics)
            {
                var curriculumChapterTopic = new CurriculumChapterTopic
                {
                    CurriculumChapterRef     = curriculumChapter.Id,
                    TopicRef                 = topic.Id,
                    ThresholdOfSuccess       = Constants.DefaultThresholdOfSuccess,
                    BlockTopicAtTesting      = false,
                    BlockCurriculumAtTesting = false
                };

                this.AddCurriculumChapterTopic(curriculumChapterTopic);
            }

            return(curriculumChapter.Id);
        }
コード例 #4
0
        private IEnumerable <UserAnswers> StudentsAnswers(ILmsService iLmsService, int[] selectGroupIds, CurriculumChapterTopic selectedCurriculumChapterTopic)
        {
            List <UserAnswers> listOfUserAnswers = new List <UserAnswers>();
            //Creation of list of all students in selected groups
            IEnumerable <User> studentsFromSelectedGroups = new List <User>();

            foreach (var groupId in selectGroupIds)
            {
                Group temp = iLmsService.FindService <IUserService>().GetGroup(groupId);
                studentsFromSelectedGroups = studentsFromSelectedGroups.Union(iLmsService.FindService <IUserService>().GetUsersByGroup(temp));
            }
            //
            foreach (User student in studentsFromSelectedGroups)
            {
                IEnumerable <AttemptResult> temp = iLmsService.FindService <ITestingService>().GetResults(student, selectedCurriculumChapterTopic);
                if (temp != null & temp.Count() != 0)
                {
                    temp = temp//.Where(attempt => attempt.CompletionStatus == CompletionStatus.Completed)
                           .OrderBy(attempt => attempt.StartTime);
                    if (temp.Count() != 0)
                    {
                        listOfUserAnswers.Add(new UserAnswers(student, temp.First(), iLmsService));
                    }
                }
            }
            return(listOfUserAnswers);
        }
コード例 #5
0
 public IEnumerable <AttemptResult> GetResults(CurriculumChapterTopic curriculumChapterTopic)
 {
     return(this.MlcProxy.GetResults(curriculumChapterTopic));
 }
コード例 #6
0
 public IEnumerable <AttemptResult> GetResults(
     User user, CurriculumChapterTopic curriculumChapterTopic, TopicTypeEnum topicType)
 {
     return(this.MlcProxy.GetResults(user, curriculumChapterTopic, topicType));
 }
コード例 #7
0
ファイル: ThemeInfoModel.cs プロジェクト: nbl852003/iudico
        public long GetAttempId(User student, CurriculumChapterTopic curriculumChapterTopic)
        {
            var res = this.lastAttempts.Find(x => x.User.Id == student.Id & x.CurriculumChapterTopic.Id == curriculumChapterTopic.Id);

            return(res != null ? res.AttemptId : -1);
        }
コード例 #8
0
ファイル: ThemeInfoModel.cs プロジェクト: nbl852003/iudico
 public bool ContainsResult(User student, CurriculumChapterTopic curriculumChapterTopic)
 {
     return(this.lastAttempts.Count(x => x.User.Id == student.Id & x.CurriculumChapterTopic.Id == curriculumChapterTopic.Id) > 0);
 }
コード例 #9
0
ファイル: CurriculumService.cs プロジェクト: nbl852003/iudico
 public bool CanPassCurriculumChapterTopic(User user, CurriculumChapterTopic curriculumChapterTopic, TopicTypeEnum topicType)
 {
     return(this.curriculumStorage.CanPassCurriculumChapterTopic(user, curriculumChapterTopic, topicType));
 }
コード例 #10
0
ファイル: SpecializedResult.cs プロジェクト: nbl852003/iudico
 public TopicResult(User user, CurriculumChapterTopic curriculumChapterTopic)
 {
     this.user = user;
     this.curriculumChapterTopic = curriculumChapterTopic;
 }
コード例 #11
0
ファイル: SpecializedResult.cs プロジェクト: nbl852003/iudico
 public TopicResult()
 {
     this.user = new User();
     this.curriculumChapterTopic = new CurriculumChapterTopic();
 }