Exemplo n.º 1
0
        private SetCourseContentViewModel GetSetCourseContentViewModel(AddNewCentreCourseTempData tempData)
        {
            if (tempData.Application == null)
            {
                throw new Exception("Application should not be null at this point in the journey");
            }

            var sections =
                sectionService.GetSectionsThatHaveTutorialsForApplication(tempData.Application.ApplicationId);

            return(new SetCourseContentViewModel(sections));
        }
Exemplo n.º 2
0
 private Customisation GetCustomisationFromTempData(AddNewCentreCourseTempData tempData)
 {
     return(new Customisation(
                User.GetCentreId(),
                tempData !.Application !.ApplicationId,
                tempData.CourseDetailsData !.CustomisationName ?? string.Empty,
                tempData.CourseDetailsData.Password,
                tempData.CourseOptionsData !.AllowSelfEnrolment,
                int.Parse(tempData.CourseDetailsData.TutCompletionThreshold !),
                tempData.CourseDetailsData.IsAssessed,
                int.Parse(tempData.CourseDetailsData.DiagCompletionThreshold !),
                tempData.CourseOptionsData.DiagnosticObjectiveSelection,
                tempData.CourseOptionsData.HideInLearningPortal,
                tempData.CourseDetailsData.NotificationEmails
                ));
 }
 public SummaryViewModel(
     AddNewCentreCourseTempData tempData
     )
 {
     ApplicationName              = tempData.CourseDetailsData !.ApplicationName;
     CustomisationName            = tempData.CourseDetailsData.CustomisationName ?? string.Empty;
     Password                     = tempData.CourseDetailsData.Password;
     NotificationEmails           = tempData.CourseDetailsData.NotificationEmails;
     PostLearningAssessment       = tempData.CourseDetailsData.IsAssessed;
     RequiredLearningPercentage   = tempData.CourseDetailsData.TutCompletionThreshold;
     RequiredDiagnosticPercentage = tempData.CourseDetailsData.DiagCompletionThreshold;
     AllowSelfEnrolment           = tempData.CourseOptionsData !.AllowSelfEnrolment;
     HideInLearningPortal         = tempData.CourseOptionsData.HideInLearningPortal;
     DiagAssess                   = tempData.Application !.DiagAssess;
     DiagnosticObjectiveSelection = tempData.CourseOptionsData.DiagnosticObjectiveSelection;
     NoContent                    = tempData.SectionContentData == null || !tempData.GetTutorialsFromSections().Any();
     IncludeAllSections           = !NoContent && tempData.CourseContentData !.IncludeAllSections;
     NumberOfLearning             = NoContent ? 0 : GetNumberOfLearning(tempData);
     NumberOfDiagnostic           = NoContent ? 0 : GetNumberOfDiagnostic(tempData);
 }
        private static int GetNumberOfDiagnostic(AddNewCentreCourseTempData tempData)
        {
            var tutorials = tempData.GetTutorialsFromSections();

            return(tutorials.Count(t => t.DiagnosticEnabled));
        }