Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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 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));
        }