private int?GetAnswerPercentage(List <ValuationTestQuestion> questions, ValuationTestQuestionItem answer) { var questionId = ObjectId.Parse(answer.Id); var question = questions.First(q => q.Id == questionId); return(question.Percentage); }
private int?GetAnswerGrade(List <ValuationTestQuestion> questions, ValuationTestQuestionItem answer) { var questionId = ObjectId.Parse(answer.Id); var question = questions.First(q => q.Id == questionId); if (question.Type == ValuationTestQuestion.ValuationTestQuestionType.Discursive) { return(null); } var correctAnswers = question.Options.Where(o => o.Correct).Select(o => o.Text); return(correctAnswers.Contains(answer.Answer) ? question.Percentage : 0); }
private ValuationTestQuestionType?GetAnswerType(List <ValuationTestQuestion> questions, ValuationTestQuestionItem answer) { var questionId = ObjectId.Parse(answer.Id); var question = questions.First(q => q.Id == questionId); return(question.Type); }