5123: Fix bug in associations filter

This commit is contained in:
Nick Hall 2014-01-22 16:06:12 +00:00
parent 19249844a1
commit c606c1f11b

View File

@ -60,13 +60,13 @@ class HasAssociation(Rule):
else: else:
self.count_type = 1 # "equal to" self.count_type = 1 # "equal to"
self.userSelectedCount = int(self.list[0]) self.selected_count = int(self.list[0])
def apply(self, db, person): def apply(self, db, person):
return len( person.get_person_ref_list()) > 0 count = len(person.get_person_ref_list())
if self.count_type == 0: # "lesser than" if self.count_type == 0: # "lesser than"
return count < self.userSelectedCount return count < self.selected_count
elif self.count_type == 2: # "greater than" elif self.count_type == 2: # "greater than"
return count > self.userSelectedCount return count > self.selected_count
# "equal to" # "equal to"
return count == self.userSelectedCount return count == self.selected_count