Example #1
0
        public QuestionModel GetNextQuestion(string userId)
        {
            var questionCount = UserProgressRepository.GetQuestionCount(userId);
            var currentPart   = UserProgressRepository.GetCurrentPartNumber(userId);

            if (currentPart == 1 && questionCount > 9)
            {
                return(null);
            }
            if (currentPart == 2 && questionCount > 2)
            {
                return(null);
            }

            var           userInformation = UserRepository.GetUserInformation(userId);
            QuestionModel question;

            if (currentPart == 1)
            {
                if (SurveySettings.ControlQuestions.Contains(questionCount))
                {
                    question = new QuestionModel("Two letters will appear on the screen. Your task is to examine the options and then pick one of the letters. There is no correct answer for any quesiton.", GenerateOptionsForPartOne(userInformation.Name, Enums.QuestionType.CONTROL), Enums.QuestionType.CONTROL);
                }
                else
                {
                    question = new QuestionModel("Two letters will appear on the screen. Your task is to examine the options and then pick one of the letters. There is no correct answer for any quesiton.", GenerateOptionsForPartOne(userInformation.Name, Enums.QuestionType.EXPERIMENTAL), Enums.QuestionType.EXPERIMENTAL);
                }
            }
            else
            {
                question = GenerateOptionsForPartTwo(questionCount, userInformation.BirthDate);
            }

            AddQuestion(userId, question);

            return(question);
        }
Example #2
0
 public int GetAnsweredQuestionCount(string userId)
 {
     return(UserProgressRepository.GetQuestionCount(userId));
 }