Skip to content

Commit

Permalink
chore: Simplify condition as result is not reused
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Oct 17, 2024
1 parent 7b62d7b commit 17b83d0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/routers/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,14 @@ async def approve_application(
# the application's `secop_data_verification`.
app_secop_dict = application.secop_data_verification.copy()
fields = list(parsers.UpdateDataField().model_dump().keys())
not_validated_fields = [key for key in fields if key not in app_secop_dict or not app_secop_dict[key]]
if not_validated_fields:
if any(not app_secop_dict.get(key) for key in fields):
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail=_("Some borrower data field are not verified"),
)

# Check all documents are verified.
not_validated_documents = [doc.type for doc in application.borrower_documents if not doc.verified]
if not_validated_documents:
if any(not doc.verified for doc in application.borrower_documents):
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail=_("Some documents are not verified"),
Expand Down

0 comments on commit 17b83d0

Please sign in to comment.