additional comments, move log statements after the actions they're logging.

This commit is contained in:
rachidatecs 2023-06-13 17:44:19 -04:00
parent 9c43fb65a9
commit 1ac56afe20
No known key found for this signature in database
GPG key ID: 3CEBBFA7325E5525
2 changed files with 13 additions and 6 deletions

View file

@ -484,15 +484,15 @@ class DomainApplication(TimeStampedModel):
) )
return return
try: try:
logger.info(
f"Submission confirmation email sent to: {self.submitter.email}"
)
send_templated_email( send_templated_email(
"emails/submission_confirmation.txt", "emails/submission_confirmation.txt",
"emails/submission_confirmation_subject.txt", "emails/submission_confirmation_subject.txt",
self.submitter.email, self.submitter.email,
context={"application": self}, context={"application": self},
) )
logger.info(
f"Submission confirmation email sent to: {self.submitter.email}"
)
except EmailSendingError: except EmailSendingError:
logger.warning("Failed to send confirmation email", exc_info=True) logger.warning("Failed to send confirmation email", exc_info=True)
@ -510,13 +510,15 @@ class DomainApplication(TimeStampedModel):
) )
return return
try: try:
logging.info(f"In review email sent to: {self.submitter.email}")
send_templated_email( send_templated_email(
"emails/status_change_in_review.txt", "emails/status_change_in_review.txt",
"emails/status_change_in_review_subject.txt", "emails/status_change_in_review_subject.txt",
self.submitter.email, self.submitter.email,
context={"application": self}, context={"application": self},
) )
logging.info(
f"In review email sent to: {self.submitter.email}"
)
except EmailSendingError: except EmailSendingError:
logger.warning( logger.warning(
"Failed to send status change (in review) email", exc_info=True "Failed to send status change (in review) email", exc_info=True
@ -572,7 +574,12 @@ class DomainApplication(TimeStampedModel):
@transition(field="status", source=SUBMITTED, target=INVESTIGATING) @transition(field="status", source=SUBMITTED, target=INVESTIGATING)
def in_review(self, updated_domain_application): def in_review(self, updated_domain_application):
"""Investigate an application that has been submitted.""" """Investigate an application that has been submitted.
This method is called in admin.py on the original application
which has the correct status value, but is passed the changed
application which has the up-to-date data that we'll use
in the email."""
# When an application is moved to in review, we need to send a # When an application is moved to in review, we need to send a
# confirmation email. This is a side-effect of the state transition # confirmation email. This is a side-effect of the state transition