-
Notifications
You must be signed in to change notification settings - Fork 1
Heedls 568 edit supervisor #699
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.
Some comments about the use of ! and a question about Single().
| progressId, | ||
| accessedVia, | ||
| supervisors, | ||
| delegateCourseProgress!.DelegateCourseInfo |
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.
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.
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.
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.
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.
That makes sense, I forgot to check the controller attributes. No problem with this, then.
| FROM aspProgress | ||
| WHERE aspProgressId = @aspProgressId", | ||
| new { aspProgressId } | ||
| ).Single(); |
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 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?
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 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.
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 very small things

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
Developer checks
(Leave tasks unticked if they haven't been appropriate for your ticket.)
I have: