public int GetOptionResponseCountByDeviceIDAndQuestion(String deviceID, MultipleChoiceQuestion question)
 {
     var responses = new List<OptionResponse>();
     foreach (var option in question.options)
     {
         responses.AddRange(option.responses.Where(m => m.participant.deviceID == deviceID));
     }
     return responses.Count();
 }
 public QuestionResponseViewModel(MultipleChoiceQuestion MCQuestion, int questionNumber, int pollID, int numberOfQuestions, List<String> messages)
 {
     this.MCQuestion = MCQuestion;
     this.questionNumber = questionNumber;
     this.numberOfQuestions = numberOfQuestions;
     this.pollID = pollID;
     this.optionList = GetResponses(null);
     this.questionType = "MCQ";
     this.messages = messages;
 }
Ejemplo n.º 3
0
 private void answerCustom(IList<Participant> participants, MultipleChoiceQuestion question, int[] distribution)
 {
     var shuffledParticipants = participants.OrderBy(item => Guid.NewGuid()).ToList<Participant>();
     for (int i = 0; i < question.options.Count; i++)
     {
         for (int j = 0; j < distribution[i]; j++)
         {
             question.options[i].responses.Add(new OptionResponse(shuffledParticipants[j]));
             question.responded.Add(shuffledParticipants[j]);
         }
     }
 }
 public MCQResponseViewModel(MultipleChoiceQuestion question)
 {
     this.question = question;
     this.optionList = GetResponses(null);
 }