Skip to content
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

PC-612 send email poll checking referral follow ups #231

Merged
merged 48 commits into from
Feb 2, 2024

Conversation

CalPinSW
Copy link
Contributor

@CalPinSW CalPinSW commented Jan 16, 2024

This isn't ready to merge yet, but want to get some eyes on. In particular, Need to work out how to include the base route of a controller/action, when calling from a function not inside a controller.

image

image

image

If clicking the email link a second time:
image

@CalPinSW CalPinSW changed the base branch from develop to PC-611-check-referral-follow-up January 23, 2024 11:47
@CalPinSW CalPinSW marked this pull request as ready for review January 24, 2024 10:09
Copy link
Collaborator

@Joe-Edwards Joe-Edwards 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 here to look at

HerPublicWebsite/appsettings.json Show resolved Hide resolved
HerPublicWebsite/Startup.cs Show resolved Hide resolved
HerPublicWebsite.Data/HerDbContext.cs Outdated Show resolved Hide resolved
HerPublicWebsite.Data/DataAccessProvider.cs Outdated Show resolved Hide resolved
<a href="@Url.Action(nameof(StaticPagesController.Index), "StaticPages")" class="govuk-link">speak to an advisor</a> for help.
</p>
</div>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Have we agreed this copy? It reads a little oddly to me, but not sure if we have UX resource to agree this with

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not yet, We originally had copy for this to all be sent in an email, when it was realised this wasn't possible I put these pages together with the aim to show to the client and get some feedback on.

I have screenshots of the pages with their copy on the Jira ticket, which Gareth has taken a look at, but we're still waiting for full confirmation that they are happy with this approach in general.

var newReferrals = await dataProvider.GetReferralRequestsWithNoFollowUpBeforeDate(endDate);
foreach (var newReferral in newReferrals) {
var referralRequestFollowUp = await referralFollowUpManager.CreateReferralRequestFollowUp(newReferral);
emailSender.SendFollowUpEmail(newReferral, config.AppBaseUrl + "referral-follow-up?token=" + referralRequestFollowUp.Token);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if there's a way we should be doing this without a hardcoded route?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm - there is if you have an httpcontext, but you won't have access to that here. It'd be nicer to construct this URL using proper methods (e.g. with escaping) but this is fine - we know the token won't contain any special characters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've done a bit more to improve this. But let me know if you want me to change anything else.

@CalPinSW CalPinSW requested a review from Joe-Edwards January 31, 2024 18:18
Copy link
Collaborator

@Joe-Edwards Joe-Edwards left a comment

Choose a reason for hiding this comment

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

A couple of small comments but I think this is looking good now, except for the issue we spoke about this morning re: historic referrals.

"Attempted to send follow up email with invalid custodian code \"{CustodianCode}\"",
referralRequest.CustodianCode
);
throw new ArgumentOutOfRangeException
Copy link
Collaborator

Choose a reason for hiding this comment

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

What will happen if we throw an error here - will anyone notice? It'll stop this and any other emails being sent.

I suspect the best we can do is just log an error and maybe use a default value instead (even just empty string).

Copy link
Contributor Author

@CalPinSW CalPinSW Feb 1, 2024

Choose a reason for hiding this comment

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

Yeah good point. I think it would cause issues with other emails being sent. I'll log it but I think we should just skip the email in that case. I think it may look a bit strange in an email.

On consideration, I can't see a situation where this is likely to occur since we're using a referral request generated with an existing custodian code to index the LAs.

var newReferrals = await dataProvider.GetReferralRequestsWithNoFollowUpBeforeDate(endDate);
foreach (var newReferral in newReferrals) {
var referralRequestFollowUp = await referralFollowUpManager.CreateReferralRequestFollowUp(newReferral);
emailSender.SendFollowUpEmail(newReferral, config.AppBaseUrl + "referral-follow-up?token=" + referralRequestFollowUp.Token);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm - there is if you have an httpcontext, but you won't have access to that here. It'd be nicer to construct this URL using proper methods (e.g. with escaping) but this is fine - we know the token won't contain any special characters.

HerPublicWebsite/appsettings.DEV.json Show resolved Hide resolved
@CalPinSW CalPinSW requested a review from Joe-Edwards February 1, 2024 15:59
Copy link
Collaborator

@Joe-Edwards Joe-Edwards left a comment

Choose a reason for hiding this comment

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

I think we probably want to update the cutoff date, but otherwise happy to merge.

HerPublicWebsite/appsettings.json Show resolved Hide resolved
@CalPinSW CalPinSW merged commit 6e6ea7f into develop Feb 2, 2024
1 check passed
@CalPinSW CalPinSW deleted the PC-612-send-email-poll-checking-referral-follow-ups branch February 2, 2024 12:19
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.

2 participants