-
Notifications
You must be signed in to change notification settings - Fork 1
HEEDLS-566 - implemented delegate progress page #643
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
| AND can.CentreID = @centreId AND can.CandidateId = c.CandidateId) AS AllAttempts"; | ||
|
|
||
| private const string AttemptsPassedQuery = | ||
| @"(SELECT COUNT(aa.AssessAttemptID) | ||
| FROM dbo.AssessAttempts AS aa | ||
| INNER JOIN dbo.Candidates AS can ON can.CandidateID = aa.CandidateID | ||
| WHERE aa.CustomisationID = cu.CustomisationID AND aa.[Status] = 1 | ||
| AND can.CentreID = @centreId) AS AttemptsPassed"; | ||
| AND can.CentreID = @centreId AND can.CandidateId = c.CandidateId) 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.
The addition of the check on candidate number on these query strings is not part of the requirements for this ticket, but it fixes a minor issue I saw while testing this.
Before the user reaches the new Delegate Progress page, they need to click a button on the Course Delegates expandable which also shows a pass rate. That pass rate was being calculated incorrectly as these values were being recovered incorrectly. These queries used to get all the attempts for all users on that course, rather than the individual in question. The additional check here means only the numbers for the individual are obtained, so the values are correct.
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 catch. It worries me a bit that we're relying on the Candidates table in a different query being aliased as c.
What about changing these into methods and passing the candidate id field reference in?
Then adding a mention of the candidate in the name makes calls read slightly more sensibly.
So e.g. QueryForNumAttemptsPassedByCandidate(string candidateIdFieldReference).
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.
These are only being used on one method, and are separated into their own consts just to make the main query a bit easier to read and understand. I've pulled these definitions into the method to help restrict any of problems that might occur in future with the candidate references.
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 great, just a couple small questions/curiosities
| public CourseAdminFieldsResult GetCourseAdminFields( | ||
| int customisationId, | ||
| int centreId, | ||
| bool allowAllCentreCourses = false |
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 like this change - just a heads up that I removed categoryId from this method altogether in another MR, so whoever's gets merged first will have to look out for merge conflicts. (It seemed like it was repeating my service filter check but I wasn't thinking about this method being used in a delegate context)
DigitalLearningSolutions.Data/DataServices/CourseDataService.cs
Outdated
Show resolved
Hide resolved
...Solutions.Web/Views/TrackingSystem/Delegates/CourseDelegates/_DelegateProgressSummary.cshtml
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.
Got about halfway through before my flight. Some changes worth making.
DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/CourseDelegatesController.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
| AND can.CentreID = @centreId AND can.CandidateId = c.CandidateId) AS AllAttempts"; | ||
|
|
||
| private const string AttemptsPassedQuery = | ||
| @"(SELECT COUNT(aa.AssessAttemptID) | ||
| FROM dbo.AssessAttempts AS aa | ||
| INNER JOIN dbo.Candidates AS can ON can.CandidateID = aa.CandidateID | ||
| WHERE aa.CustomisationID = cu.CustomisationID AND aa.[Status] = 1 | ||
| AND can.CentreID = @centreId) AS AttemptsPassed"; | ||
| AND can.CentreID = @centreId AND can.CandidateId = c.CandidateId) 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.
Good catch. It worries me a bit that we're relying on the Candidates table in a different query being aliased as c.
What about changing these into methods and passing the candidate id field reference in?
Then adding a mention of the candidate in the name makes calls read slightly more sensibly.
So e.g. QueryForNumAttemptsPassedByCandidate(string candidateIdFieldReference).
DigitalLearningSolutions.Data/Models/Courses/DelegateCourseDetails.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Data.Tests/Services/CourseServiceTests.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.
Looks good, just a couple of things that could be improved on the view.
...LearningSolutions.Web/Views/TrackingSystem/Delegates/CourseDelegates/DelegateProgress.cshtml
Outdated
Show resolved
Hide resolved
...LearningSolutions.Web/Views/TrackingSystem/Delegates/CourseDelegates/DelegateProgress.cshtml
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.
Nice, merge away.

JIRA link
https://softwiretech.atlassian.net/browse/HEEDLS-566
Description
Implemented a new page for showing delegate progress details.
This reused some code in pre-existing methods, so I have done a little refactoring to make things nicer.
I've also refactored the GetCourseAdminFields data service method (and the methods that call it) to no longer require a categoryId parameter that was not being used, and instead take in a bool to determine whether or not courses with the AllCentres column as 1 should be recovered.
Screenshots
Note that I forgot to put in breadcrumbs when taking the screenshots, but they are there in the code.

Desktop:
Tablet:

Mobile:

Developer checks
(Leave tasks unticked if they haven't been appropriate for your ticket.)
I have: