Skip to content

Commit

Permalink
fixing issue of compliance article, fix: checking crr before calling …
Browse files Browse the repository at this point in the history
…send email
  • Loading branch information
isuru-aot committed Mar 25, 2024
1 parent 175ad82 commit ba573a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions services/core-api/app/api/mines/reports/models/mine_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ def mine_report_status_description(cls):
def __repr__(self):
return '<MineReport %r>' % self.mine_report_guid

def send_report_update_email(self, is_edit, is_proponent, crr_or_prr):

report_code = "code" if crr_or_prr == "CRR" else "permit"
def send_crr_add_notification_email(self, is_edit, is_proponent):
subject = f'Code Required Report Submitted for mine {self.mine.mine_name}'
core_recipients = [MDS_EMAIL]
ms_recipients = []
Expand All @@ -140,7 +138,7 @@ def send_report_update_email(self, is_edit, is_proponent, crr_or_prr):
core_recipients, ms_recipients = self.collectRecipients(is_proponent)
core_recipients.extend(self.getReportSpecificEmailsByReportType())

core_report_page_link = f'{Config.CORE_PRODUCTION_URL}/mine-dashboard/{self.mine.mine_guid}/required-reports/{report_code}-required-reports'
core_report_page_link = f'{Config.CORE_PRODUCTION_URL}/mine-dashboard/{self.mine.mine_guid}/required-reports/code-required-reports'
ms_report_page_link = f'{Config.MINESPACE_PRODUCTION_URL}/mines/{self.mine.mine_guid}/reports'
c_article = self.mine_report_definition.compliance_articles[0]
report_type = f'{c_article.section}.{c_article.sub_section}.{c_article.paragraph} - {self.mine.mine_name}'
Expand Down Expand Up @@ -175,7 +173,7 @@ def send_report_update_email(self, is_edit, is_proponent, crr_or_prr):
ms_email_body = open("app/templates/email/report/ms_new_report_submitted_email.html", "r").read()
EmailService.send_template_email(subject, ms_recipients, ms_email_body, email_context, cc=None)

else:
def send_report_update_email(self, is_edit):
recipients = [self.mine.region.regional_contact_office.email, MDS_EMAIL]
if self.mine.major_mine_ind:
recipients = [MAJOR_MINES_OFFICE_EMAIL, MDS_EMAIL]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ def post(self):
previous_submission.is_latest = False
previous_submission.save()

if create_initial_report:
mine_report.send_report_update_email(False, is_proponent, report_type)
if create_initial_report and report_type == "CRR":
mine_report.send_crr_add_notification_email(False, is_proponent)

return report_submission, 201

Expand Down

0 comments on commit ba573a2

Please sign in to comment.