Skip to content

Commit fdfec84

Browse files
authored
Merge pull request #313 from dinesh-aot/fixes
preliminary_review_details content fix
2 parents cdd5ac1 + ef39673 commit fdfec84

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

compliance-api/src/compliance_api/services/inspection_record/inspection_record.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def switch_to_final(cls, inspection_id, inspection_record_id):
122122
"preliminary_review_details", None
123123
),
124124
"enforcement_summary": ir_data.get("enforcement_summary", None),
125+
"action_required_by_rp": None, # This field should be NONE when you switch to final
125126
"ir_status_id": IRStatusEnum.FINAL.value,
126127
"ir_progress": IRProgressEnum.FINALIZING_RECORD,
127128
}

compliance-api/src/compliance_api/services/inspection_record/inspection_record_builder.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,12 @@ def build_preliminary_review_details(self):
284284
# No preliminary_review_details for ir when it is PRELIMINARY
285285
if self.ir_status == IRStatusEnum.PRELIMINARY.value:
286286
preliminary_review_details = None
287-
elif self.ir_status == IRStatusEnum.FINAL.value and self.existing_ir:
287+
elif self.ir_status == IRStatusEnum.FINAL.value:
288+
inspection_record = InspectionRecordModel.get_by_inspection_id(self.inspection.id)
288289
approvals = InspectionRecordApprovalModel.get_approvals_by_ir(
289-
self.existing_ir.id
290+
inspection_record.id
290291
)
292+
# Build comma separated dates from the approval requests
291293
if approvals:
292294
data = {
293295
"date_report_sent": ", ".join(
@@ -301,11 +303,15 @@ def build_preliminary_review_details(self):
301303
if approval.date_response is not None
302304
),
303305
}
306+
# Bulid the project details if not yet build to get the proponent label
307+
if not self.data.get("project_details"):
308+
self.build_project_details()
309+
data["proponent_label"] = self.data["project_details"]["proponent_label"]
310+
data["primary_last_name"] = self.inspection.primary_officer.last_name
304311
preliminary_review_details = render_template_with_data(
305312
"PRELIMINARY_REVIEW_DETAILS", PRELIMINARY_REVIEW_DETAILS, data
306313
)
307-
308-
self.data["preliminary_review_details"] = preliminary_review_details
314+
self.data["preliminary_review_details"] = preliminary_review_details
309315
return self
310316

311317
def build_finding_statement(self):

compliance-api/src/compliance_api/services/inspection_record/ir_template_constant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
PRELIMINARY_REVIEW_DETAILS = """<div>
3838
<p class="editor-paragraph" dir="ltr">
3939
<span>
40-
On {{ date_report_sent}} ., Officer [Lombardi] provided the preliminary
40+
On {{ date_report_sent}} ., Officer {{ primary_last_name }} provided the preliminary
4141
inspection record to the {{ proponent_label }}.
4242
AND</span><br><span>On {{ date_repsonse }} ., the {{ proponent_label }}
4343
provided comments pertaining to the preliminary inspection record. These comments were reviewed, and edits

compliance-api/src/compliance_api/templates/ir_template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@
481481
</th>
482482
</tr>
483483
<tr>
484-
<td colspan="2">{{ action_required_by_rp | safe | replace('style="white-space: pre-wrap;"', '') }}
484+
<td colspan="2">{% if action_required_by_rp %}{{ action_required_by_rp | safe | replace('style="white-space: pre-wrap;"', '') }}{% else %}None at this time{% endif %}
485485
</td>
486486
</tr>
487487
<tr>

0 commit comments

Comments
 (0)