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

22363 Continuation in email templates #2946

Merged
merged 6 commits into from
Aug 28, 2024

Conversation

severinbeauvais
Copy link
Collaborator

Issue #: bcgov/entity#22363

Description of changes:

  • added attachment for RESUBMITTED continuation in
  • added subjects for other statuses/options
  • created APPROVED email template
  • created CHANGE_REQUESTED email template
  • created REJECTED email template
  • created RESUBMITTED email template
  • added latest_review_comment template variable
  • updated Rejected template

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the lear license (Apache 2.0).

Severin Beauvais added 2 commits August 23, 2024 16:21
- added subjects for other statuses/options
- created APPROVED email template
- created CHANGE_REQUESTED email template
- created REJECTED email template
- created RESUBMITTED email template
@severinbeauvais severinbeauvais self-assigned this Aug 27, 2024
@severinbeauvais severinbeauvais marked this pull request as ready for review August 28, 2024 20:13
- expanded continuation in tests
@severinbeauvais
Copy link
Collaborator Author

Please review this PR. It's for the emails as we know them right now. It's likely they will change but this way we don't lose the work done so far (as it will be in the commit history).

There are no new unit test errors.

'attachOrder': str(attach_order)
}
)
attach_order += 1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resubmitted is similar to "submitted" (ie, paid) except no receipt is attached.

jnja_template = Template(filled_template, autoescape=True)
review_result = ReviewResult.get_last_review_result(filing.id)
# encode newlines in review comment only
latest_review_comment = review_result.comments.replace('\n', '\\n') if review_result else None
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did this to "encode" the line break, because the Jinja render engine otherwise removes them.

On line 192 I "decode" the line breaks.

Sample of a multi-line staff review comment:

image

# get template and fill in parts
template = Path(f'{current_app.config.get("TEMPLATE_PATH")}/CONT-IN-{status}.html').read_text()
filled_template = substitute_template_parts(template)
jnja_template = Template(filled_template, autoescape=True)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I simply moved a few things around to make sense, ie:

  1. first prepare the variables
  2. then get the template
  3. finally, render it

<li>Modify the application to satisfy the request from staff as described below:</li>
</ol>

<pre class="bold">{{ latest_review_comment }}</pre>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Pre-formatted looked the best to me (see sample above).

Copy link
Collaborator

@ArwenQin ArwenQin 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, thanks!

Copy link

sonarcloud bot commented Aug 28, 2024

@severinbeauvais severinbeauvais merged commit 5a14c84 into bcgov:main Aug 28, 2024
5 of 6 checks passed
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.

3 participants