-
Notifications
You must be signed in to change notification settings - Fork 1
HEEDLS-555 View delegate page - course section #498
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
HEEDLS-555 View delegate page - course section #498
Conversation
…fo data service method; write test
…ate controller; update tests
…ds in View Delegate page
…wers list to DelegateCourseInfo VM
…e to service method
…ler; write data service method; write tests
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.
Few minor things, might require some refactoring to use CustomPromptWithAnswer class.
DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateCourseInfoViewModel.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateCourseInfoViewModel.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml
Outdated
Show resolved
Hide resolved
...ningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/_DelegateCourseInfoCard.cshtml
Show resolved
Hide resolved
...ningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/_DelegateCourseInfoCard.cshtml
Show resolved
Hide resolved
DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateCourseInfoViewModel.cs
Outdated
Show resolved
Hide resolved
add service method; write test; update view/vm/controller
simplify nullable date assignments; add empty actions dd to fix row separators; fix swapped field values; remove unneeded role=alert
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.
Looks good. Minor comment about renaming a display field, but no need for reapproval from me.
I think the empty action on all the fields should fix the line issue, but it would be nice to have an updated screen shot as well.
...ningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/_DelegateCourseInfoCard.cshtml
Outdated
Show resolved
Hide resolved
…or ViewDelegate accessibility test to avoid timeout
Fix problem of lonely % sign when value is null, without needing an extra check in the view
...ningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/_DelegateCourseInfoCard.cshtml
Outdated
Show resolved
Hide resolved
...ningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/_DelegateCourseInfoCard.cshtml
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/ViewDelegateViewModel.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Data/DataServices/CourseDataService.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Data/DataServices/CourseDataService.cs
Outdated
Show resolved
Hide resolved
| INNER JOIN dbo.Applications AS ap ON ap.ApplicationID = cu.ApplicationID | ||
| WHERE (ap.CourseCategoryID = @categoryId OR @categoryId = 0) | ||
| AND cu.CentreID = @centreId | ||
| AND ap.ArchivedDate IS NULL |
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 never need to pull archived courses to my knowledge - any reason for this change?
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 decided to move these filters into the service.
CategoryId filter needed to be optional, so we added service methods to make it cleaner.
Then I wasn't sure whether or not archived courses were included in delegate courses, so pulled that filter out too for consistency. If it's more flexible than needed I can put the archived date filter back into the sql?
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 we should keep the Archived filter in the SQL for now, we can always bring it back if we need to in the future, but it seems unlikely that we would want to show archived courses.
| namespace DigitalLearningSolutions.Data.Services | ||
| { | ||
| using System.Collections.Generic; | ||
| using System.Linq; |
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.
This is getting quite long - I wonder if we could refactor this into two separate services, one for registration prompts and the other for admin fields.. Olivia is working on this too atm, so she could potentially do the refactor later.
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 agree with this, it's at a similar length to the UserDataService I've just split. @livzorn FYI, this split might come your way at the end of the admin fields work.
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.
@AlexJacksonDS ah yeah thanks, I'll keep that in mind!
| @"SELECT COUNT(aa.Status) AS TotalAttempts, | ||
| COUNT(CASE WHEN aa.Status=1 THEN 1 END) AS AttemptsPassed |
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 wonder if it makes sense pulling these two numbers together with other course data?
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 thought it would make the query too complicated. Also these are not needed in many cases any where IsAssessed=0.
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 there is a bit more refactoring needed in that case (also see my comment on the controller). If these aren't needed because IsAssessed=0, why are we still always calling it?
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 I think need changing.
DigitalLearningSolutions.Data.Tests/DataServices/CourseDataServiceTests.cs
Show resolved
Hide resolved
| @"SELECT COUNT(aa.Status) AS TotalAttempts, | ||
| COUNT(CASE WHEN aa.Status=1 THEN 1 END) AS AttemptsPassed |
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 there is a bit more refactoring needed in that case (also see my comment on the controller). If these aren't needed because IsAssessed=0, why are we still always calling it?
| INNER JOIN dbo.Applications AS ap ON ap.ApplicationID = cu.ApplicationID | ||
| WHERE (ap.CourseCategoryID = @categoryId OR @categoryId = 0) | ||
| AND cu.CentreID = @centreId | ||
| AND ap.ArchivedDate IS NULL |
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 we should keep the Archived filter in the SQL for now, we can always bring it back if we need to in the future, but it seems unlikely that we would want to show archived courses.
DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss
Outdated
Show resolved
Hide resolved
Also don't fetch attempt stats if course not assessed
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.
Some remaining ArchivedDate to remove still.
I don't think an IEnumerable<(DelegateCourseInfo info, List prompts, (int, int) stats)> is a good idea really. Replace this with an IEnumerable of a new class
New CourseService method needs unit tests, unless I've missed them?
DigitalLearningSolutions.Data.Tests/TestHelpers/CustomPromptsTestHelper.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Data/DataServices/CustomPromptsDataService.cs
Outdated
Show resolved
Hide resolved
…t stats, custom fields
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.
Looks OK to me now 👍
Supervisor: YES; Completed: NO; Assessed: YES; Attempts: NO; Custom fields: NO
Supervisor: NO; Completed: YES; Assessed: YES; Attempts: YES; Custom fields: NO
Supervisor: NO; Completed: NO; Assessed: NO; Attempts: NO; Custom fields: YES
Tablet
Mobile