Skip to content

Commit

Permalink
Modified standard product check function
Browse files Browse the repository at this point in the history
  • Loading branch information
binni979 committed May 6, 2024
1 parent 5d73536 commit 42d575b
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions pyQuARC/code/custom_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,17 @@ def dif_standard_product_check(*field_values):
@staticmethod
def standard_product_check(*field_values):
"""
Check if any of the provided field values contains the 'StandardProduct' substring.
This function iterates over a tuple of field values. It checks each field value to determine if it contains
the substring 'StandardProduct'. The check stops at the first occurrence of such a substring, returning
a dictionary indicating the validity of the check and the value where 'StandardProduct' was found.
This function iterates over a tuple of field values. It checks each field value to determine
if it contains the field_value True or False.
"""
validity = False
value = None

for field_value in field_values:
if field_value:
if 'StandardProduct' in field_value:
value = field_value
validity = True
break
if field_value in [True, False]:
value = field_value
validity = True
break
return {"valid": validity, "value": value}

@staticmethod
Expand Down

0 comments on commit 42d575b

Please sign in to comment.