Skip to content

Commit

Permalink
review 1.0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigo Sestari committed Feb 20, 2019
1 parent 2850c91 commit 825eaf9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion business_rules/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,20 @@ def _assert_valid_value_and_cast(self, value):
format(value))
return value

def __contains(self, list_string):
if len(list_string) > 0:
if list_string[0] in self.value:
return True
else:
return self.__contains(list_string[1:])
else:
return False

@type_operator(FIELD_TEXT)
def contains_all(self, list_string):
return len(list(filter(lambda y: y is True, list(map(lambda x: x in self.value, list_string))))) == len(
list_string)

@type_operator(FIELD_TEXT)
def contains_at_least_one_element(self, list_string):
return len(list(filter(lambda y: y is True, list(map(lambda x: x in self.value, list_string))))) > 0
return self.__contains(list_string)

0 comments on commit 825eaf9

Please sign in to comment.