venmo/business-rules

numeric_rule_variable issue for the attributes like "Age"

jdsinh opened this issue · 1 comments

I have records of 100 students on which I apply the rule.

One of the variable is

@numeric_rule_variable
def age(self):
    if self.student.age is not None:
        return self.contact.age
    else:
        return ????

If age is not present in some of the students what should I return in "else: part as this variable expects to return something numerical,

You can return -1 or any other negative integer code in else part, and then you can put conditions for this return value.{ "name": age, "operator": greater_than, "value": 0 }