-
Notifications
You must be signed in to change notification settings - Fork 1
Heedls 443 edit learning pathway defaults #635
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few points, mostly minor.
...lutions.Web/Views/TrackingSystem/CourseSetup/ManageCourse/EditLearningPathwayDefaults.cshtml
Outdated
Show resolved
Hide resolved
| css-class="nhsuk-input nhsuk-input--width-10" /> | ||
| </div> | ||
|
|
||
| <div class="nhsuk-checkboxes nhsuk-u-margin-bottom-3"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a checkboxes view component that takes in a list of view models that could be used in here unless there's a good reason I am missing. See the EditAdminFields in the Tracking System for an example.
Looking at the screenshots, we could also do with a little more space between the checkboxes and the text input above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the spacing looks good here.
I see what you mean about the checkboxes view component as well. For reference, I don't believe that view components can have nullable/optional parameters, but you can put an empty string in (though in this case it would still create some HTML without any content). David is implementing a single-checkbox view component in 512, so if that ends up getting merged before this, it might be worth including it, but for now its probably fine as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, of course you could just leave the label blank :) I will use David's checkbox component once it's merged!
...lutions.Web/Views/TrackingSystem/CourseSetup/ManageCourse/EditLearningPathwayDefaults.cshtml
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Controllers/TrackingSystem/CourseSetup/ManageCourseController.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Controllers/TrackingSystem/CourseSetup/ManageCourseController.cs
Outdated
Show resolved
Hide resolved
...ingSolutions.Web.Tests/Controllers/TrackingSystem/CourseSetup/ManageCourseControllerTests.cs
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Controllers/TrackingSystem/CourseSetup/ManageCourseController.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Controllers/TrackingSystem/CourseSetup/ManageCourseController.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Controllers/TrackingSystem/CourseSetup/ManageCourseController.cs
Outdated
Show resolved
Hide resolved
...lutions.Web/Views/TrackingSystem/CourseSetup/ManageCourse/EditLearningPathwayDefaults.cshtml
Show resolved
Hide resolved
5522020 to
87294f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor things, mostly looks like a namespace got messed up.
.../ViewModels/TrackingSystem/CourseSetup/CourseDetails/EditLearningPathwayDefaultsViewModel.cs
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Controllers/TrackingSystem/CourseSetup/ManageCourseController.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/ViewModels/Common/ViewComponents/NumericInputViewModel.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/ViewModels/Common/ViewComponents/RadiosListItemViewModel.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Views/Shared/Components/NumericInput/Default.cshtml
Outdated
Show resolved
Hide resolved
...talLearningSolutions.Web/ViewModels/Common/ViewComponents/NumberOfAdministratorsViewModel.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/ViewModels/Common/ViewComponents/LogoViewModel.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/ViewComponents/NumericInputViewComponent.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/ViewComponents/NumericInputViewComponent.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good.
| private readonly int lowerBound; | ||
| private readonly int upperBound; | ||
|
|
||
| public WholeNumberWithinRangeAttribute(int lowerBound, int upperBound, string errorMessage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to make clear that these bounds are inclusive (i.e. 35 is within the range 4-35).
I think adding inclusive into either the attribute name or the parameter names is the way to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, renamed to WholeNumberWithinInclusiveRangeAttribute
| public class WholeNumberWithinRangeAttributeTests | ||
| { | ||
| [Test] | ||
| public void Accepts_number_within_range() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could reduce these to a single test using [TestCaseSource] like in LinkedFieldHelperTests.cs.
It's nice to have the names of the tests to tell us what each case is for. You could keep that by passing a failure message in with the test data and giving it to NUnit for when the test fails. I believe FluentAssertions lets you do that quite easily. This article should send you in the right direction, though may not have everything you need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used [TestCaseSource] to refactor the tests and I'm passing in a custom test name with each one :)
b637c81 to
825e884
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things that need tidying up, mainly around the new view components.
...ingSolutions.Web.Tests/Controllers/TrackingSystem/CourseSetup/ManageCourseControllerTests.cs
Outdated
Show resolved
Hide resolved
...lutions.Web/Views/TrackingSystem/CourseSetup/ManageCourse/EditLearningPathwayDefaults.cshtml
Outdated
Show resolved
Hide resolved
...lutions.Web/Views/TrackingSystem/CourseSetup/ManageCourse/EditLearningPathwayDefaults.cshtml
Outdated
Show resolved
Hide resolved
...lutions.Web/Views/TrackingSystem/CourseSetup/ManageCourse/EditLearningPathwayDefaults.cshtml
Outdated
Show resolved
Hide resolved
...lutions.Web/Views/TrackingSystem/CourseSetup/ManageCourse/EditLearningPathwayDefaults.cshtml
Outdated
Show resolved
Hide resolved
...lutions.Web/Views/TrackingSystem/CourseSetup/ManageCourse/EditLearningPathwayDefaults.cshtml
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/ViewComponents/NumericInputViewComponent.cs
Outdated
Show resolved
Hide resolved
d7e1a12 to
5faf077
Compare

JIRA link
HEEDLS-443
Description
Added a new page at TrackingSystem/CourseSetup/{customisationId}/Manage/LearningPathwayDefaults with a form to edit the learning pathway defaults of a course. The controller contains some custom validations and error messages, checking whether the inputs for CompleteWithinMonths and ValidityMonths are numbers and within the range of 0 to 48 inclusive. If the input is null those values are saved as 0 (those columns are non-nullable) so that the user can leave them blank if they do not want to configure values.
Screenshots
Developer checks
I have: