示例#1
0
        public BlindSpotQuizAttempts GetLatestAttemptByUser(string user)
        {
            var userAttempts = _blindSpotAttemptsMongoHelper.GetData(
                FilterDefinitionHandler.FilterBlindSpotQuizByUserId(user)
                , _blindSpotAttemptCollection);

            return(userAttempts.Where(att => att.attemptcount == userAttempts?.Max(x => x.attemptcount))?.FirstOrDefault());
        }
        public int GetAttemptCountForBlindSpotQuiz(string userid)
        {
            var result = _blindSpotQuizAttempts.GetData(FilterDefinitionHandler.FilterBlindSpotQuizByUserId(userid),
                                                        _blindSpotQuizAttemptCollection)?.OrderByDescending(x => x.attemptcount);

            if (result != null && result.Any())
            {
                return(result.FirstOrDefault().attemptcount);
            }


            return(0);
        }
        public int GetAttemptedQuizCountByUser(string userid)
        {
            var attempted = 0;



            if (_curiousQuizAttempts.GetDocumentCount(FilterDefinitionHandler.FilterCuriosityByUserId(userid),
                                                      _curiousQuizAttemptCollection) > 0)
            {
                attempted += 1;
            }

            if (_growthMindsetQuizAttempts.GetDocumentCount(FilterDefinitionHandler.FilterGrowthMindsetByUserId(userid),
                                                            _growthMindsetQuizAttemptCollection) > 0)
            {
                attempted += 1;
            }

            if (_makingTimeForMeQuizAttempts.GetDocumentCount(FilterDefinitionHandler.FilterMakingTimeQuizByUserId(userid),
                                                              _makingTimeForMeAttemptCollection) > 0)
            {
                attempted += 1;
            }

            if (_cultureObservationToolQuizAttempts.GetDocumentCount(FilterDefinitionHandler.FilterCultureObservationQuizByUserId(userid),
                                                                     _cultureObservationQuizAttemptCollection) > 0)
            {
                attempted += 1;
            }

            if (_blindSpotQuizAttempts.GetDocumentCount(FilterDefinitionHandler.FilterBlindSpotQuizByUserId(userid),
                                                        _blindSpotQuizAttemptCollection) > 0)
            {
                attempted += 1;
            }

            if (_continuousLearningQuizAttempts.GetDocumentCount(FilterDefinitionHandler.FilterContinuousLearningQuizByUserId(userid),
                                                                 _continuousLearningQuizAttemptCollection) > 0)
            {
                attempted += 1;
            }

            if (_learningMythsQuizAttempts.GetDocumentCount(FilterDefinitionHandler.FilterLearningMythsQuizByUserId(userid),
                                                            _learningMythsQuizAttemptCollection) > 0)
            {
                attempted += 1;
            }

            if (_productivityZoneQuizAttempts.GetDocumentCount(FilterDefinitionHandler.FilterProductivityZoneQuizByUserId(userid),
                                                               _productivityZoneQuizAttemptCollection) > 0)
            {
                attempted += 1;
            }

            if (_reflectionToolQuizAttempts.GetDocumentCount(FilterDefinitionHandler.FilterReflectionToolQuizByUserId(userid),
                                                             _reflectionToolQuizAttemptCollection) > 0)
            {
                attempted += 1;
            }

            if (_storyTellingForImpactQuizAttempts.GetDocumentCount(FilterDefinitionHandler.FilterStoryTellingForImpactQuizByUserId(userid),
                                                                    _storyTellingForImpactAttemptQuizCollection) > 0)
            {
                attempted += 1;
            }


            return(attempted);
        }