-
Notifications
You must be signed in to change notification settings - Fork 1
HEEDLS-435 - implemented Manage Course Page #506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
DanBloxham-sw
merged 7 commits into
master
from
HEEDLS-435-CourseSetupBasicCourseDetails
Jul 27, 2021
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0cdac3c
HEEDLS-435 - implemented Manage Course Page
DanBloxham-sw c82c867
HEEDLS-435 - Added CourseDetails unit tests and update styling
DanBloxham-sw 27306c5
Merge branch 'master' into HEEDLS-435-CourseSetupBasicCourseDetails
DanBloxham-sw bd6ff3a
HEEDLS-435 - review markups
DanBloxham-sw ab4f1a2
HEEDLS-435 - correct missed elements
DanBloxham-sw b72ad60
HEEDLS-435 - Further review markups
DanBloxham-sw 999606b
HEEDLS-435 - update course details completion criteria
DanBloxham-sw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
DigitalLearningSolutions.Data.Tests/Models/CourseDetailsTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| namespace DigitalLearningSolutions.Data.Tests.Models | ||
| { | ||
| using DigitalLearningSolutions.Data.Models.Courses; | ||
| using FluentAssertions; | ||
| using NUnit.Framework; | ||
|
|
||
| public class CourseDetailsTests | ||
| { | ||
| [Test] | ||
| public void RefreshedToCourseName_should_be_Same_Course_if_RefreshToId_is_Zero() | ||
| { | ||
| // When | ||
| var courseDetails = new CourseDetails | ||
| { | ||
| ApplicationName = "Original course", | ||
| CustomisationName = "name", | ||
| RefreshToCustomisationId = 0 | ||
| }; | ||
|
|
||
| // Then | ||
| courseDetails.RefreshToCourseName.Should().BeEquivalentTo("Same course"); | ||
| } | ||
|
|
||
| [Test] | ||
| public void RefreshedToCourseName_should_be_CourseName_if_RefreshToId_is_CustomisationId() | ||
| { | ||
| // When | ||
| var courseDetails = new CourseDetails | ||
| { | ||
| ApplicationName = "Original course", | ||
| CustomisationName = "name", | ||
| CustomisationId = 5, | ||
| RefreshToCustomisationId = 5 | ||
| }; | ||
|
|
||
| // Then | ||
| courseDetails.RefreshToCourseName.Should().BeEquivalentTo("Same course"); | ||
| } | ||
|
|
||
|
|
||
| [Test] | ||
| public void RefreshedToCourseName_should_be_from_refresh_course_if_RefreshToId_is_not_zero_or_CustomisationId() | ||
| { | ||
| // When | ||
| var courseDetails = new CourseDetails | ||
| { | ||
| ApplicationName = "Original course", | ||
| CustomisationName = "name", | ||
| CustomisationId = 5, | ||
| RefreshToCustomisationId = 10, | ||
| RefreshToApplicationName = "Refreshed course", | ||
| RefreshToCustomisationName = "refreshing" | ||
| }; | ||
|
|
||
| // Then | ||
| courseDetails.RefreshToCourseName.Should().BeEquivalentTo("Refreshed course - refreshing"); | ||
| } | ||
|
|
||
| [Test] | ||
| public void RefreshedToCourseName_should_be_from_refresh_course_application_if_RefreshToId_is_not_zero_or_CustomisationId_and_customisation_name_is_null() | ||
| { | ||
| // When | ||
| var courseDetails = new CourseDetails | ||
| { | ||
| ApplicationName = "Original course", | ||
| CustomisationName = "name", | ||
| CustomisationId = 5, | ||
| RefreshToCustomisationId = 10, | ||
| RefreshToApplicationName = "Refreshed course", | ||
| RefreshToCustomisationName = null | ||
| }; | ||
|
|
||
| // Then | ||
| courseDetails.RefreshToCourseName.Should().BeEquivalentTo("Refreshed course"); | ||
| } | ||
|
|
||
| [Test] | ||
| public void CourseName_should_be_ApplicationName_and_CustomisationName_if_CustomisationName_not_null() | ||
| { | ||
| // When | ||
| var courseDetails = new CourseDetails | ||
| { | ||
| ApplicationName = "Original course", | ||
| CustomisationName = "name", | ||
| }; | ||
|
|
||
| // Then | ||
| courseDetails.CourseName.Should().BeEquivalentTo("Original course - name"); | ||
| } | ||
|
|
||
|
|
||
| [Test] | ||
| public void CourseName_should_be_ApplicationName_if_CustomisationName_is_blank() | ||
| { | ||
| // When | ||
| var courseDetails = new CourseDetails | ||
| { | ||
| ApplicationName = "Original course", | ||
| CustomisationName = string.Empty | ||
| }; | ||
|
|
||
| // Then | ||
| courseDetails.CourseName.Should().BeEquivalentTo("Original course"); | ||
| } | ||
|
|
||
| [Test] | ||
| public void InProgressCount_should_be_TotalDelegates_minus_CompletedCount() | ||
| { | ||
| // When | ||
| var courseDetails = new CourseDetails | ||
| { | ||
| DelegateCount = 123, | ||
| CompletedCount = 81 | ||
| }; | ||
|
|
||
| // Then | ||
| courseDetails.InProgressCount.Should().Be(42); | ||
| } | ||
| } | ||
|
|
||
| } | ||
74 changes: 74 additions & 0 deletions
74
DigitalLearningSolutions.Data.Tests/TestHelpers/CourseDetailsTestHelper.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| namespace DigitalLearningSolutions.Data.Tests.TestHelpers | ||
| { | ||
| using System; | ||
| using DigitalLearningSolutions.Data.Models.Courses; | ||
|
|
||
| public static class CourseDetailsTestHelper | ||
| { | ||
| public static CourseDetails GetDefaultCourseDetails( | ||
| int customisationId = 100, | ||
| int centreId = 101, | ||
| string applicationName = "Entry Level - Win XP, Office 2003/07 OLD", | ||
| string customisationName = "Standard", | ||
| int currentVersion = 12, | ||
| DateTime? createdTime = null, | ||
| DateTime? lastAccessed = null, | ||
| string? password = null, | ||
| string? notificationEmails = null, | ||
| bool postLearningAssessment = false, | ||
| bool isAssessed = true, | ||
| int tutCompletionThreshold = 100, | ||
| bool diagAssess = false, | ||
| int diagCompletionThreshold = 85, | ||
| bool selfRegister = true, | ||
| bool diagObjSelect = true, | ||
| bool hideInLearnerPortal = false, | ||
| bool active = false, | ||
| int delegateCount = 25, | ||
| int completedCount = 5, | ||
| int completeWithinMonths = 0, | ||
| int validityMonths = 0, | ||
| bool mandatory = false, | ||
| bool autoRefresh = false, | ||
| int refreshToCustomisationId = 0, | ||
| string? refreshToApplicationName = null, | ||
| string? refreshToCustomisationName = null, | ||
| int autoRefreshMonths = 0, | ||
| bool applyLpDefaultsToSelfEnrol = false | ||
| ) | ||
| { | ||
| return new CourseDetails | ||
| { | ||
| CustomisationId = customisationId, | ||
| CentreId = centreId, | ||
| ApplicationName = applicationName, | ||
| CustomisationName = customisationName, | ||
| CurrentVersion = currentVersion, | ||
| CreatedTime = createdTime ?? DateTime.UtcNow, | ||
| LastAccessed = lastAccessed ?? DateTime.UtcNow, | ||
| Password = password, | ||
| NotificationEmails = notificationEmails, | ||
| PostLearningAssessment = postLearningAssessment, | ||
| IsAssessed = isAssessed, | ||
| TutCompletionThreshold = tutCompletionThreshold, | ||
| DiagAssess = diagAssess, | ||
| DiagCompletionThreshold = diagCompletionThreshold, | ||
| SelfRegister = selfRegister, | ||
| DiagObjSelect = diagObjSelect, | ||
| HideInLearnerPortal = hideInLearnerPortal, | ||
| Active = active, | ||
| DelegateCount = delegateCount, | ||
| CompletedCount = completedCount, | ||
| CompleteWithinMonths = completeWithinMonths, | ||
| ValidityMonths = validityMonths, | ||
| Mandatory = mandatory, | ||
| AutoRefresh = autoRefresh, | ||
| RefreshToCustomisationId = refreshToCustomisationId, | ||
| RefreshToApplicationName = refreshToApplicationName, | ||
| RefreshToCustomisationName = refreshToCustomisationName, | ||
| AutoRefreshMonths = autoRefreshMonths, | ||
| ApplyLpDefaultsToSelfEnrol = applyLpDefaultsToSelfEnrol | ||
| }; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
DigitalLearningSolutions.Data/Models/Courses/CourseDetails.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| namespace DigitalLearningSolutions.Data.Models.Courses | ||
| { | ||
| using System; | ||
|
|
||
| public class CourseDetails | ||
| { | ||
| public int CustomisationId { get; set; } | ||
| public int CentreId { get; set; } | ||
| public string ApplicationName { get; set; } | ||
| public string CustomisationName { get; set; } | ||
| public int CurrentVersion { get; set; } | ||
| public DateTime CreatedTime { get; set; } | ||
| public DateTime? LastAccessed { get; set; } | ||
| public string? Password { get; set; } | ||
| public string? NotificationEmails { get; set; } | ||
| public bool PostLearningAssessment { get; set; } | ||
| public bool IsAssessed { get; set; } | ||
| public int TutCompletionThreshold { get; set; } | ||
| public bool DiagAssess { get; set; } | ||
| public int DiagCompletionThreshold { get; set; } | ||
| public bool SelfRegister { get; set; } | ||
| public bool DiagObjSelect { get; set; } | ||
| public bool HideInLearnerPortal { get; set; } | ||
| public bool Active { get; set; } | ||
| public int DelegateCount { get; set; } | ||
| public int CompletedCount { get; set; } | ||
| public int CompleteWithinMonths { get; set; } | ||
| public int ValidityMonths { get; set; } | ||
| public bool Mandatory { get; set; } | ||
| public bool AutoRefresh { get; set; } | ||
| public int RefreshToCustomisationId { get; set; } | ||
| public string? RefreshToApplicationName { get; set; } | ||
| public string? RefreshToCustomisationName { get; set; } | ||
| public int AutoRefreshMonths { get; set; } | ||
| public bool ApplyLpDefaultsToSelfEnrol { get; set; } | ||
|
|
||
| public int InProgressCount => DelegateCount - CompletedCount; | ||
|
|
||
| public string CourseName => string.IsNullOrWhiteSpace(CustomisationName) | ||
| ? ApplicationName | ||
| : ApplicationName + " - " + CustomisationName; | ||
|
|
||
| public string? RefreshToCourseName | ||
| { | ||
| get | ||
| { | ||
| if (RefreshToCustomisationId == 0 || RefreshToCustomisationId == CustomisationId) | ||
| { | ||
| return "Same course"; | ||
| } | ||
|
|
||
| if (string.IsNullOrWhiteSpace(RefreshToApplicationName)) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| return string.IsNullOrWhiteSpace(RefreshToCustomisationName) | ||
| ? RefreshToApplicationName | ||
| : RefreshToApplicationName + " - " + RefreshToCustomisationName; | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.