Skip to content

Commit

Permalink
Merge pull request #190 from dinesh-aot/COMP-298
Browse files Browse the repository at this point in the history
inpsection requirement field changes
  • Loading branch information
dinesh-aot authored Jan 8, 2025
2 parents 7aad517 + 8418a6e commit 5860224
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,20 @@ class InspectionReqSourceDetailCreateSchema(BaseSchema):
condition_number = fields.Str(
metadata={
"description": "The optional condition number associated with"
"rquirement sources(Schedule B, EAC Certificate)"
"rquirement sources(Schedule B, EAC Certificate, EAC Amendment)"
}
)
amendment_number = fields.Str(
metadata={
"description": "The optional amendment number if the requirement source is EAC Amendment"
"description": "The amendment number if the requirement source is EAC Amendment"
}
)
title = fields.Str(
metadata={"description": "The title of the requirement source detail"}
)
description = fields.Str(
metadata={"description": "The description of the requirement source detail"}
metadata={"description": "The description of the requirement source detail"},
required=True
)
documents = fields.List(fields.Nested(InspectionReqDetailDocCreateSchema))

Expand Down Expand Up @@ -107,12 +108,12 @@ def validate_amendment_number(
amendment_number = data.get("amendment_number", [])
requirement_source_id = data.get("requirement_source_id", None)
if (
amendment_number
and RequirementSourceEnum(requirement_source_id)
!= RequirementSourceEnum.EAC_AMENDMENT
RequirementSourceEnum(requirement_source_id)
== RequirementSourceEnum.EAC_AMENDMENT
and not amendment_number
):
raise ValidationError(
"Invalid requirement source for the given amendment number",
"Amendment number is mandatory when the requirement source is EAC_AMENDMENT",
field_name="amendment_number",
)

Expand All @@ -126,6 +127,7 @@ def validate_condition_number(
if condition_number and RequirementSourceEnum(requirement_source_id) not in [
RequirementSourceEnum.SCHEDULE_B,
RequirementSourceEnum.EAC_CERTIFICATE,
RequirementSourceEnum.EAC_AMENDMENT,
]:
raise ValidationError(
"Invalid requirement source for the given condition number",
Expand Down Expand Up @@ -163,7 +165,8 @@ class InspectionRequirementCreateSchema(BaseSchema):
metadata={"description": "The unique identifier of the compliance findings."}
)
findings = fields.Str(
metadata={"description": "The requirement findings in html format."}
metadata={"description": "The requirement findings in html format."},
required=True
)
sort_order = fields.Int(
metadata={"description": "The order of the inspection requirements"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def _create_requirement_obj(inspection_id, requirement_data):
"sort_order": requirement_data.get("sort_order"),
"enforcement_action_id": requirement_data.get("enforcement_action_id", None),
"compliance_finding_id": requirement_data.get("compliance_finding_id", None),
"findings": requirement_data.get("findings", None),
"findings": requirement_data.get("findings"),
}


Expand All @@ -147,7 +147,7 @@ def _create_requirement_source_detail_obj(requirement_id, requirement_source_dat
"condition_number": requirement_source_data.get("condition_number", None),
"amendment_number": requirement_source_data.get("amendment_number", None),
"title": requirement_source_data.get("title", None),
"description": requirement_source_data.get("description", None),
"description": requirement_source_data.get("description"),
}


Expand Down

0 comments on commit 5860224

Please sign in to comment.