Move from object references to IDs
svn: r2822
This commit is contained in:
@@ -181,8 +181,8 @@ def get_niece(level):
|
||||
return _niece_level[level]
|
||||
|
||||
def is_spouse(orig,other):
|
||||
for f in orig.getFamilyList():
|
||||
if other == f.getFather() or other == f.getMother():
|
||||
for f in orig.get_family_id_list():
|
||||
if other == f.get_father_id() or other == f.get_mother_id():
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -204,8 +204,8 @@ def get_relationship(orig_person,other_person):
|
||||
if orig_person == None:
|
||||
return ("undefined",[])
|
||||
|
||||
firstName = orig_person.getPrimaryName().getRegularName()
|
||||
secondName = other_person.getPrimaryName().getRegularName()
|
||||
firstName = orig_person.get_primary_name().get_regular_name()
|
||||
secondName = other_person.get_primary_name().get_regular_name()
|
||||
|
||||
if orig_person == other_person:
|
||||
return ('', [])
|
||||
@@ -217,7 +217,7 @@ def get_relationship(orig_person,other_person):
|
||||
|
||||
for person in firstList:
|
||||
if person in secondList:
|
||||
new_rank = firstMap[person.getId()]
|
||||
new_rank = firstMap[person.get_id()]
|
||||
if new_rank < rank:
|
||||
rank = new_rank
|
||||
common = [ person ]
|
||||
@@ -231,48 +231,48 @@ def get_relationship(orig_person,other_person):
|
||||
|
||||
if length == 1:
|
||||
person = common[0]
|
||||
secondRel = firstMap[person.getId()]
|
||||
firstRel = secondMap[person.getId()]
|
||||
secondRel = firstMap[person.get_id()]
|
||||
firstRel = secondMap[person.get_id()]
|
||||
elif length == 2:
|
||||
p1 = common[0]
|
||||
secondRel = firstMap[p1.getId()]
|
||||
firstRel = secondMap[p1.getId()]
|
||||
secondRel = firstMap[p1.get_id()]
|
||||
firstRel = secondMap[p1.get_id()]
|
||||
elif length > 2:
|
||||
person = common[0]
|
||||
secondRel = firstMap[person.getId()]
|
||||
firstRel = secondMap[person.getId()]
|
||||
secondRel = firstMap[person.get_id()]
|
||||
firstRel = secondMap[person.get_id()]
|
||||
|
||||
if firstRel == -1:
|
||||
return ("",[])
|
||||
elif firstRel == 0:
|
||||
if secondRel == 0:
|
||||
return ('',common)
|
||||
elif other_person.getGender() == RelLib.Person.male:
|
||||
elif other_person.get_gender() == RelLib.Person.male:
|
||||
return (get_father(secondRel),common)
|
||||
else:
|
||||
return (get_mother(secondRel),common)
|
||||
elif secondRel == 0:
|
||||
if other_person.getGender() == RelLib.Person.male:
|
||||
if other_person.get_gender() == RelLib.Person.male:
|
||||
return (get_son(firstRel),common)
|
||||
else:
|
||||
return (get_daughter(firstRel),common)
|
||||
elif firstRel == 1:
|
||||
if other_person.getGender() == RelLib.Person.male:
|
||||
if other_person.get_gender() == RelLib.Person.male:
|
||||
return (get_uncle(secondRel),common)
|
||||
else:
|
||||
return (get_aunt(secondRel),common)
|
||||
elif secondRel == 1:
|
||||
if other_person.getGender() == RelLib.Person.male:
|
||||
if other_person.get_gender() == RelLib.Person.male:
|
||||
return (get_nephew(firstRel-1),common)
|
||||
else:
|
||||
return (get_niece(firstRel-1),common)
|
||||
elif secondRel > firstRel:
|
||||
if other_person.getGender() == RelLib.Person.male:
|
||||
if other_person.get_gender() == RelLib.Person.male:
|
||||
return (get_senior_male_cousin(firstRel-1,secondRel-firstRel),common)
|
||||
else:
|
||||
return (get_senior_female_cousin(firstRel-1,secondRel-firstRel),common)
|
||||
else:
|
||||
if other_person.getGender() == RelLib.Person.male:
|
||||
if other_person.get_gender() == RelLib.Person.male:
|
||||
return (get_junior_male_cousin(secondRel-1,firstRel-secondRel),common)
|
||||
else:
|
||||
return (get_junior_female_cousin(secondRel-1,firstRel-secondRel),common)
|
||||
|
||||
Reference in New Issue
Block a user