Example #1
0
        public void GetScormPlayerUrl_returns_expected()
        {
            // Given
            const string expected = "https://www.dls.nhs.uk/scoplayer/sco";

            // Then
            OldSystemEndpointHelper.GetScormPlayerUrl(config).Should().Be(expected);
        }
Example #2
0
        public void GetTrackingUrl_returns_expected()
        {
            // Given
            const string expected = "https://www.dls.nhs.uk/tracking/tracker";

            // Then
            OldSystemEndpointHelper.GetTrackingUrl(config).Should().Be(expected);
        }
Example #3
0
        public void GetConsolidationPathUrl_returns_expected()
        {
            // Given
            const string consolidationPath = "path";
            const string expected          = "https://www.dls.nhs.uk/tracking/dlconsolidation?client=path";

            // Then
            OldSystemEndpointHelper.GetConsolidationPathUrl(config, consolidationPath).Should().Be(expected);
        }
Example #4
0
        public void GetDownloadSummaryUrl_returns_expected()
        {
            // Given
            const int    progressId = 1;
            const string expected   = "https://www.dls.nhs.uk/tracking/summary?ProgressID=1";

            // Then
            OldSystemEndpointHelper.GetDownloadSummaryUrl(config, progressId).Should().Be(expected);
        }
Example #5
0
 private string GetScormSource(IConfiguration config, TutorialContent tutorialContent)
 {
     return($"{OldSystemEndpointHelper.GetScormPlayerUrl(config)}" +
            $"?CentreID={CentreId}" +
            $"&CustomisationID={CustomisationId}" +
            $"&TutorialID={TutorialId}" +
            $"&CandidateID={CandidateId}" +
            $"&Version={tutorialContent.Version}" +
            $"&tutpath={tutorialContent.TutorialPath}");
 }
Example #6
0
 private string GetHtmlSource(IConfiguration config, TutorialContent tutorialContent)
 {
     return($"{tutorialContent.TutorialPath}" +
            $"?CentreID={CentreId}" +
            $"&CustomisationID={CustomisationId}" +
            $"&TutorialID={TutorialId}" +
            $"&CandidateID={CandidateId}" +
            $"&Version={tutorialContent.Version}" +
            $"&ProgressID={ProgressId}" +
            "&type=learn" +
            $"&TrackURL={OldSystemEndpointHelper.GetTrackingUrl(config)}");
 }
        public SectionContentViewModel(IConfiguration config, SectionContent sectionContent, int customisationId, int sectionId)
        {
            CourseTitle                = sectionContent.CourseTitle;
            CourseDescription          = sectionContent.CourseDescription;
            SectionName                = sectionContent.SectionName;
            PercentComplete            = FormatPercentComplete(sectionContent);
            ShowPercentComplete        = sectionContent.HasLearning && sectionContent.CourseSettings.ShowPercentage;
            CustomisationId            = customisationId;
            SectionId                  = sectionId;
            ShowPostLearning           = sectionContent.PostLearningAssessmentPath != null && sectionContent.IsAssessed;
            PostLearningStatus         = GetPostLearningStatus(sectionContent);
            PostLearningStatusStyling  = GetPostLearningStatusStyling(sectionContent);
            ShowDiagnostic             = sectionContent.DiagnosticAssessmentPath != null && sectionContent.DiagnosticStatus;
            DiagnosticCompletionStatus = GetDiagnosticCompletionStatus(sectionContent);
            ConsolidationExercisePath  = sectionContent.ConsolidationPath == null
                ? null
                : OldSystemEndpointHelper.GetConsolidationPathUrl(config, sectionContent.ConsolidationPath);
            ShowConsolidation          = ConsolidationExercisePath != null;
            ConsolidationExerciseLabel = sectionContent.CourseSettings.ConsolidationExercise ?? "Consolidation Exercise";

            Tutorials = sectionContent.Tutorials.Select(tutorial => new TutorialCardViewModel(
                                                            tutorial,
                                                            sectionContent.CourseSettings.ShowTime,
                                                            sectionContent.CourseSettings.ShowLearnStatus,
                                                            sectionId,
                                                            customisationId
                                                            ));

            DisplayDiagnosticSeparator   = ShowDiagnostic && (sectionContent.Tutorials.Any() || ShowPostLearning || ShowConsolidation);
            DisplayTutorialSeparator     = sectionContent.Tutorials.Any() && (ShowPostLearning || ShowConsolidation);
            DisplayPostLearningSeparator = ShowConsolidation && ShowPostLearning;
            NextSectionId                  = sectionContent.NextSectionId;
            ShowCompletionSummary          = sectionContent.IncludeCertification && !sectionContent.OtherSectionsExist;
            OtherSectionsExist             = sectionContent.OtherSectionsExist;
            CompletionSummaryCardViewModel = new CompletionSummaryCardViewModel(
                customisationId,
                sectionContent.Completed,
                sectionContent.MaxPostLearningAssessmentAttempts,
                sectionContent.IsAssessed,
                sectionContent.PostLearningAssessmentPassThreshold,
                sectionContent.DiagnosticAssessmentCompletionThreshold,
                sectionContent.TutorialsCompletionThreshold
                );
        }
Example #8
0
        public DiagnosticContentViewModel(
            IConfiguration config,
            DiagnosticContent diagnosticContent,
            List <int> selectedTutorials,
            int customisationId,
            int centreId,
            int sectionId,
            int progressId,
            int candidateId
            )
        {
            CustomisationId = customisationId;
            SectionId       = sectionId;
            SectionName     = diagnosticContent.SectionName;
            CourseTitle     = diagnosticContent.CourseTitle;

            var tutorials = diagnosticContent.CanSelectTutorials
                ? selectedTutorials
                : diagnosticContent.Tutorials;

            ContentSource = ContentViewerHelper.IsScormPath(diagnosticContent.DiagnosticAssessmentPath)
                ? ContentViewerHelper.GetScormAssessmentSource(
                OldSystemEndpointHelper.GetScormPlayerUrl(config),
                centreId,
                customisationId,
                candidateId,
                sectionId,
                diagnosticContent.Version,
                diagnosticContent.DiagnosticAssessmentPath,
                type)
                : ContentViewerHelper.GetHtmlAssessmentSource(
                diagnosticContent.DiagnosticAssessmentPath,
                centreId,
                customisationId,
                candidateId,
                sectionId,
                diagnosticContent.Version,
                progressId,
                type,
                OldSystemEndpointHelper.GetTrackingUrl(config),
                tutorials,
                diagnosticContent.PassThreshold);
        }
Example #9
0
        public CourseCompletionViewModel(IConfiguration config, CourseCompletion courseCompletion, int progressId)
        {
            CustomisationId    = courseCompletion.Id;
            CourseTitle        = courseCompletion.CourseTitle;
            IsAssessed         = courseCompletion.IsAssessed;
            DiagnosticScore    = courseCompletion.DiagnosticScore;
            PostLearningPasses = courseCompletion.PostLearningPasses;
            SectionCount       = courseCompletion.SectionCount;

            PercentageTutorialsCompleted = Convert.ToInt32(Math.Floor(courseCompletion.PercentageTutorialsCompleted));

            CompletionStatus    = courseCompletion.Completed == null ? "incomplete" : "complete";
            ShowDiagnosticScore = DiagnosticScore != null && courseCompletion.DiagnosticAttempts > 0;
            ShowPercentageTutorialsCompleted = PercentageTutorialsCompleted > 0;

            FinaliseText = GetEvaluationOrCertificateText(
                courseCompletion.Completed,
                courseCompletion.Evaluated,
                courseCompletion.IsAssessed
                );

            FinaliseAriaLabel = FinaliseText switch
            {
                "Evaluate" => "Evaluate course",
                "Certificate" => "View or print certificate",
                _ => null
            };

            SummaryText = CompletionSummaryHelper.GetCompletionSummary(
                courseCompletion.Completed,
                courseCompletion.MaxPostLearningAssessmentAttempts,
                courseCompletion.IsAssessed,
                courseCompletion.PostLearningAssessmentPassThreshold,
                courseCompletion.DiagnosticAssessmentCompletionThreshold,
                courseCompletion.TutorialsCompletionThreshold
                );

            DownloadSummaryUrl = OldSystemEndpointHelper.GetDownloadSummaryUrl(config, progressId);
            FinaliseUrl        = OldSystemEndpointHelper.GetEvaluateUrl(config, progressId);
        }
        public PostLearningContentViewModel(
            IConfiguration config,
            PostLearningContent postLearningContent,
            int customisationId,
            int centreId,
            int sectionId,
            int progressId,
            int candidateId
            )
        {
            CustomisationId = customisationId;
            SectionId       = sectionId;
            SectionName     = postLearningContent.SectionName;
            CourseTitle     = postLearningContent.CourseTitle;

            ContentSource = ContentViewerHelper.IsScormPath(postLearningContent.PostLearningAssessmentPath)
                ? ContentViewerHelper.GetScormAssessmentSource(
                OldSystemEndpointHelper.GetScormPlayerUrl(config),
                centreId,
                customisationId,
                candidateId,
                sectionId,
                postLearningContent.Version,
                postLearningContent.PostLearningAssessmentPath,
                type)
                : ContentViewerHelper.GetHtmlAssessmentSource(
                postLearningContent.PostLearningAssessmentPath,
                centreId,
                customisationId,
                candidateId,
                sectionId,
                postLearningContent.Version,
                progressId,
                type,
                OldSystemEndpointHelper.GetTrackingUrl(config),
                postLearningContent.Tutorials,
                postLearningContent.PassThreshold);
        }
        public DelegateProgressViewModel(
            DelegateAccessRoute accessedVia,
            DetailedCourseProgress progress,
            IConfiguration config,
            ReturnPageQuery?returnPageQuery = null
            ) : base(progress, accessedVia, returnPageQuery)
        {
            IsCourseActive = progress.IsCourseActive;

            AdminFields = progress.CourseAdminFields.Select(
                cp =>
                new DelegateCourseAdminField(
                    cp.PromptNumber,
                    cp.PromptText,
                    cp.Answer
                    )
                )
                          .ToList();

            ProgressDownloadUrl = OldSystemEndpointHelper.GetDownloadSummaryUrl(config, progress.ProgressId);;

            Sections = progress.Sections.Select(s => new SectionProgressViewModel(s));
        }
Example #12
0
 public CompletedCourseViewModel(CompletedLearningItem course, IConfiguration config) : base(course)
 {
     EvaluateUrl = OldSystemEndpointHelper.GetEvaluateUrl(config, course.ProgressID);
 }