Exemple #1
0
 public TutorialCardViewModel(
     SectionTutorial tutorial,
     bool showTime,
     bool showLearnStatus,
     int sectionId,
     int customisationId
     )
 {
     Id               = tutorial.Id;
     TutorialName     = tutorial.TutorialName;
     CompletionStatus = tutorial.CompletionStatus;
     ShowLearnStatus  = showLearnStatus;
     TimeSummary      = new TutorialTimeSummaryViewModel(
         tutorial.TutorialTime,
         tutorial.AverageTutorialTime,
         showTime,
         showLearnStatus
         );
     SectionId                = sectionId;
     CustomisationId          = customisationId;
     RecommendationStatus     = tutorial.CurrentScore < tutorial.PossibleScore ? "Recommended" : "Optional";
     StatusTagColour          = tutorial.CurrentScore < tutorial.PossibleScore ? "nhsuk-tag--orange" : "nhsuk-tag--green";
     ShowRecommendationStatus = tutorial.TutorialDiagnosticAttempts > 0 && showLearnStatus && tutorial.TutorialDiagnosticStatus;
 }
Exemple #2
0
        public TutorialViewModel(
            IConfiguration config,
            TutorialInformation tutorialInformation,
            int customisationId,
            int sectionId
            )
        {
            TutorialName             = tutorialInformation.Name;
            SectionName              = tutorialInformation.SectionName;
            CourseTitle              = tutorialInformation.CourseTitle;
            CourseDescription        = tutorialInformation.CourseDescription;
            TutorialPath             = tutorialInformation.TutorialPath;
            VideoPath                = tutorialInformation.VideoPath;
            Status                   = tutorialInformation.Status;
            ShowLearnStatus          = tutorialInformation.CourseSettings.ShowLearnStatus;
            SupportingMaterialsLabel =
                tutorialInformation.CourseSettings.SupportingInformation ?? "Download supporting materials";

            CustomisationId = customisationId;
            SectionId       = sectionId;
            TutorialId      = tutorialInformation.Id;
            Objectives      = ParseObjectives(tutorialInformation.Objectives);

            CanShowProgress = GetCanShowProgress(
                tutorialInformation.CourseSettings.ShowLearnStatus,
                tutorialInformation.CanShowDiagnosticStatus,
                tutorialInformation.AttemptCount
                );
            TutorialRecommendation =
                GetTutorialRecommendation(tutorialInformation.CurrentScore, tutorialInformation.PossibleScore);
            ScoreSummary = GetScoreSummary(tutorialInformation.CurrentScore, tutorialInformation.PossibleScore);
            TimeSummary  = new TutorialTimeSummaryViewModel(
                tutorialInformation.TimeSpent,
                tutorialInformation.AverageTutorialDuration,
                tutorialInformation.CourseSettings.ShowTime,
                tutorialInformation.CourseSettings.ShowLearnStatus
                );
            SupportingMaterialPath =
                ContentUrlHelper.GetNullableContentPath(config, tutorialInformation.SupportingMaterialPath);
            NextLinkViewModel = new TutorialNextLinkViewModel(
                customisationId,
                sectionId,
                tutorialInformation.PostLearningAssessmentPath,
                tutorialInformation.NextTutorialId,
                tutorialInformation.NextSectionId
                );

            OnlyItemInOnlySection = !tutorialInformation.OtherItemsInSectionExist && !tutorialInformation.OtherSectionsExist;
            OnlyItemInThisSection = !tutorialInformation.OtherItemsInSectionExist;
            ShowCompletionSummary = OnlyItemInOnlySection && tutorialInformation.IncludeCertification;

            CompletionSummaryCardViewModel = new CompletionSummaryCardViewModel(
                customisationId,
                tutorialInformation.Completed,
                tutorialInformation.MaxPostLearningAssessmentAttempts,
                tutorialInformation.IsAssessed,
                tutorialInformation.PostLearningAssessmentPassThreshold,
                tutorialInformation.DiagnosticAssessmentCompletionThreshold,
                tutorialInformation.TutorialsCompletionThreshold
                );
            TutorialStartButtonAdditionalStyling = tutorialInformation.Status == "Complete" ? "nhsuk-button--secondary" : "";
            TutorialStartButtonText = tutorialInformation.Status == "Complete" ? "Restart tutorial" : "Start tutorial";
            ShowNextButton          = tutorialInformation.Status == "Complete" && !OnlyItemInOnlySection;
        }