Skip to content

Conversation

@DanBloxham-sw
Copy link
Contributor

@DanBloxham-sw DanBloxham-sw commented Sep 28, 2021

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:
Desktop delegate progress

Tablet:

Mobile:


Developer checks

(Leave tasks unticked if they haven't been appropriate for your ticket.)

I have:

  • Run the formatter and made sure there are no IDE errors.
  • Written tests for the changes (controller, data services, services, view models etc) and manually tested my work with and without JavaScript. Full manual testing guidelines can be found here: https://softwiretech.atlassian.net/wiki/spaces/HEE/pages/6703648740/Testing
  • Updated/added documentation in Swiki and/or Readme.
  • Updated my Jira ticket with information about other parts of the system that were touched as part of the MR and have to be sanity tested to ensure nothing’s broken.
  • Scanned over my own MR to ensure everything is as expected.

Comment on lines 20 to 27
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";
Copy link
Contributor Author

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.

Copy link
Contributor

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).

Copy link
Contributor Author

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.

@DanBloxham-sw
Copy link
Contributor Author

New screenshot of page with the inactive inset (and the breadcrumbs that were mistakenly excluded from before)
Desktop inactive inset

Copy link
Contributor

@livzorn livzorn left a 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
Copy link
Contributor

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)

@SteveJacksonSoft SteveJacksonSoft changed the base branch from master to HEEDLS-351-recaptcha October 1, 2021 17:49
@SteveJacksonSoft SteveJacksonSoft changed the base branch from HEEDLS-351-recaptcha to master October 1, 2021 17:49
Copy link
Contributor

@SteveJacksonSoft SteveJacksonSoft left a 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.

Comment on lines 20 to 27
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";
Copy link
Contributor

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).

Copy link
Contributor

@SteveJacksonSoft SteveJacksonSoft left a 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.

Copy link
Contributor

@SteveJacksonSoft SteveJacksonSoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, merge away.

@DanBloxham-sw DanBloxham-sw merged commit ca09e40 into master Oct 6, 2021
@DanBloxham-sw DanBloxham-sw deleted the HEEDLS-566-DelegateCourseProgressPage branch October 6, 2021 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants