From: Eric D. <er...@do...> - 2013-12-28 17:34:01
|
Hi I have some questions about the filter class IsAncestorOf(Rule): """Rule that checks for a person that is an ancestor of a specified person"" " In this filter we found all the ancestor of a specific person by browsing the ancestor Tree. but when we browse these tree deeply. For instance when we reach a person that we already reach before it seems to me that it s no use to explore his parents again as we did it already before. for small trees it make no differences but with big trees with a lot of common ancestors it make a huge difference. i proposed the following patch. what do you think of? diff -u person/_isancestorof.py person2/_isancestorof.py --- person/_isancestorof.py 2013-11-08 10:26:10.000000000 +0100 +++ person2/_isancestorof.py 2013-12-28 18:29:00.701558002 +0100 @@ -34,7 +34,6 @@ # #------------------------------------------------------------------------- from .. import Rule - #------------------------------------------------------------------------- # # IsAncestorOf @@ -71,8 +70,8 @@ def init_ancestor_list(self, db, person,first): if not person: return - if not first: - self.map.add(person.handle) + if person.handle in self.map: + return fam_id = person.get_main_parents_family_handle() fam = db.get_family_from_handle(fam_id) @@ -84,3 +83,5 @@ self.init_ancestor_list(db,db.get_person_from_handle(f_id),0) if m_id: self.init_ancestor_list(db,db.get_person_from_handle(m_id),0) + if not first: + self.map.add(person.handle) |