Skip to content

Conversation

@AlexJacksonDS
Copy link
Contributor

@AlexJacksonDS AlexJacksonDS commented Oct 28, 2021

JIRA link

https://softwiretech.atlassian.net/browse/HEEDLS-568

Description

Added a new Edit Supervisor page linked from the View Delegate course cards and the Delegate Progress page

Screenshots

image
image
image


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 (accessibility tests, unit tests for controller, data services, services, view models, etc)
  • 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. Links (if any) are below:
  • 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.

@AlexJacksonDS
Copy link
Contributor Author

Updated post show and tell to allow unsetting a supervisor
image

Copy link
Contributor

@JBsoftwire JBsoftwire left a comment

Choose a reason for hiding this comment

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

Some comments about the use of ! and a question about Single().

progressId,
accessedVia,
supervisors,
delegateCourseProgress!.DelegateCourseInfo
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we be confident in this ! assertion? Someone might try to come to this page by entering the URL directly, or the state of the data might change during a session, so I think we should handle the null case explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, because we are protected by the VerifyAdminUserCanAccessProgress ServiceFilter, which handles the progess == null, return NotFound case. I suppose it is technically less efficient since we're doing double database queries, but that seems to be the pattern we've decided with all these service filters.

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense, I forgot to check the controller attributes. No problem with this, then.

FROM aspProgress
WHERE aspProgressId = @aspProgressId",
new { aspProgressId }
).Single();
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this must work since the tests pass, but my understanding of the Single() LINQ operator is that it throws if there's not exactly one result, so this can never return null. Can you tell me what I've got wrong here?

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 column SupervisorVerificationRequested is a nullable datetime, so if the aspProgress record exists but has null it will return null, hence the DateTime? return type.
As you say, this will throw an exception if there is not exactly one result, but since we are looking it up by aspProgressId and using it in a unit test this is the behaviour we would want. i.e. this will only throw an exception if the aspProgress record gets deleted from the database for some reason.

Copy link
Contributor

@davidm-m davidm-m left a comment

Choose a reason for hiding this comment

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

A few very small things

@AlexJacksonDS AlexJacksonDS merged commit aa10585 into master Nov 10, 2021
@AlexJacksonDS AlexJacksonDS deleted the HEEDLS-568-edit-supervisor branch November 10, 2021 15:58
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