Exemple #1
0
 public McqComponentAdapt(string parentId, MultipleChoiceQuestionTextOnly inputComponent) : base(parentId, inputComponent)
 {
     Body  = inputComponent.QuestionText;
     Items = inputComponent.Answers?.Select(m => new TextQuestionItem()
     {
         Text             = m.Answer,
         ShouldBeSelected = YesOptionHelper.IsYesOptionChecked(m.IsThisACorrectAnswer),
         Feedback         = m.IncorrectFeedback
     }).ToList();
     Selectable =
         inputComponent.Answers?.Count(m => YesOptionHelper.IsYesOptionChecked(m.IsThisACorrectAnswer)) ?? 0;
     QuestionFeedback = new QuestionFeedback()
     {
         Title     = inputComponent.FeedbackTitle,
         Correct   = inputComponent.FeedbackIfCorrect,
         Incorrect = new QuestionFeedbackCorrectFinal()
         {
             Final = inputComponent.FeedbackIfIncorrect
         },
         PartlyCorrect = new QuestionFeedbackCorrectFinal()
         {
             Final = inputComponent.FeedbackIfPartlyCorrect
         },
     };
 }
 public CmcqComponentAdapt(string parentId, MultipleChoiceQuestionWithCode inputComponent) : base(parentId, inputComponent)
 {
     Body  = inputComponent.QuestionText;
     Items = inputComponent.Answers?.Select(m => new CodeQuestionItem()
     {
         Title = m.Title,
         Code  = new ComponentAdaptCode()
         {
             Code = m.Code,
             Lang = m.AvailableLanguagesLanguage.FirstOrDefault()?.Codename?.ToLower()
         },
         Feedback         = m.IncorrectFeedback,
         ShouldBeSelected = YesOptionHelper.IsYesOptionChecked(m.IsThisAnswerCorrect)
     }).ToList();
     Selectable =
         inputComponent.Answers?.Count(m => YesOptionHelper.IsYesOptionChecked(m.IsThisAnswerCorrect)) ?? 0;
     QuestionFeedback = new QuestionFeedback()
     {
         Title     = inputComponent.FeedbackTitle,
         Correct   = inputComponent.FeedbackIfCorrect,
         Incorrect = new QuestionFeedbackCorrectFinal()
         {
             Final = inputComponent.FeedbackIfIncorrect
         },
         PartlyCorrect = new QuestionFeedbackCorrectFinal()
         {
             Final = inputComponent.FeedbackIfPartlyCorrect
         }
     };
 }