コード例 #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
         },
     };
 }
コード例 #2
0
 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
         }
     };
 }
コード例 #3
0
 public NarrativeComponentAdapt(string parentId, Narrative inputComponent) : base(parentId, inputComponent)
 {
     Body            = inputComponent.Intro;
     SetCompletionOn = GetCompletion(YesOptionHelper.IsYesOptionChecked(inputComponent.RequireAllItemsBeSeen));
     Items           = inputComponent?.NarrativeItems.Select(m => new NarrativeComponentItem()
     {
         Title   = m.Title,
         Body    = m.Text,
         Graphic = GraphicHelper.GetSimpleGraphic(m.Image)
     }).ToList();
 }
コード例 #4
0
 protected BaseAdaptComponent(string parentId, IBaseComponent inputComponent)
 {
     Id                = inputComponent.System.Id;
     ParentId          = parentId;
     DisplayTitle      = string.IsNullOrEmpty(inputComponent.DisplayTitle) ? inputComponent.Title : inputComponent.DisplayTitle; // user title if display title is not set
     Instructions      = inputComponent.Instructions;
     Layout            = GetLayout(inputComponent.Layout);
     Title             = inputComponent.Title;
     IsOptional        = YesOptionHelper.IsYesOptionChecked(inputComponent.IsOptional);
     Classes           = string.Join(" ", inputComponent.ComponentClasses.Select(m => m.Name)); // take name because codename might ruin class name
     PageLevelProgress = new PageLevelProgressAdapt()
     {
         IsEnabled = YesOptionHelper.IsYesOptionChecked(inputComponent.IncludeInProgress)
     };
 }
コード例 #5
0
 public NarrativeWithCodeComponentAdapt(string parentId, NarrativeCode inputComponent) : base(parentId, inputComponent)
 {
     Body            = inputComponent.Intro;
     SetCompletionOn = GetCompletion(YesOptionHelper.IsYesOptionChecked(inputComponent.RequireAllCodeBeSee));
     Items           = inputComponent?.NarrativeCodeItems.Select(m => new NarrativeWithCodeComponentItem()
     {
         Title = m.Title,
         Body  = m.Text,
         Code  = new ComponentAdaptCode()
         {
             Code = m.Code,
             Lang = m.AvailableLanguagesLanguage?.FirstOrDefault()?.Codename?.ToLower()
         }
     }).ToList();
 }