@@ -134,7 +134,15 @@ def _build_officer_attendance(self):
134134 attendance_list .append (option .data )
135135 else :
136136 # If no data, use the attendance option name
137- attendance_list .append (option .attendance_option .name )
137+ if (
138+ option .attendance_option_id
139+ == InspectionAttendanceOptionEnum .CERTIFICATE_HOLDER_OR_REGULATED_PARTY_REPRESENTATIVE .value
140+ ):
141+ if not self .data .get ("project_details" ):
142+ self .build_project_details ()
143+ attendance_list .append (self .data ["project_details" ]["proponent" ])
144+ else :
145+ attendance_list .append (option .attendance_option .name )
138146
139147 # Join all attendance items with commas
140148 attendance_string = ", " .join (attendance_list ) if attendance_list else ""
@@ -285,7 +293,9 @@ def build_preliminary_review_details(self):
285293 if self .ir_status == IRStatusEnum .PRELIMINARY .value :
286294 preliminary_review_details = None
287295 elif self .ir_status == IRStatusEnum .FINAL .value :
288- inspection_record = InspectionRecordModel .get_by_inspection_id (self .inspection .id )
296+ inspection_record = InspectionRecordModel .get_by_inspection_id (
297+ self .inspection .id
298+ )
289299 approvals = InspectionRecordApprovalModel .get_approvals_by_ir (
290300 inspection_record .id
291301 )
@@ -306,7 +316,9 @@ def build_preliminary_review_details(self):
306316 # Bulid the project details if not yet build to get the proponent label
307317 if not self .data .get ("project_details" ):
308318 self .build_project_details ()
309- data ["proponent_label" ] = self .data ["project_details" ]["proponent_label" ]
319+ data ["proponent_label" ] = self .data ["project_details" ][
320+ "proponent_label"
321+ ]
310322 data ["primary_last_name" ] = self .inspection .primary_officer .last_name
311323 preliminary_review_details = render_template_with_data (
312324 "PRELIMINARY_REVIEW_DETAILS" , PRELIMINARY_REVIEW_DETAILS , data
0 commit comments