Skip to content

Commit

Permalink
- ADding None check
Browse files Browse the repository at this point in the history
  • Loading branch information
elipe17 committed Sep 20, 2023
1 parent 780a6c7 commit 0750677
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tdrs-backend/tdpservice/parsers/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def sumIsLarger(fields, val):
def sumIsLargerFunc(value):
sum = 0
for field in fields:
sum += value[field] if type(value) is dict else getattr(value, field)
val = value[field] if type(value) is dict else getattr(value, field)
sum += 0 if val is None else val

return (True, None) if sum > val else (False, f"The sum of {fields} is not larger than {val}.")

Expand Down

0 comments on commit 0750677

Please sign in to comment.