Better fix of error in step and cousin relations.
svn: r11024
This commit is contained in:
parent
83edeb4a62
commit
1c9a0458b5
@ -86,6 +86,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
|||||||
return u"avlägset släkt"
|
return u"avlägset släkt"
|
||||||
else:
|
else:
|
||||||
result = inlaw + _cousin_level[level]
|
result = inlaw + _cousin_level[level]
|
||||||
|
# Indicate step relations) by adding ' [styv]'
|
||||||
if step:
|
if step:
|
||||||
result = result + ' [styv]'
|
result = result + ' [styv]'
|
||||||
return result
|
return result
|
||||||
@ -96,7 +97,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
|||||||
for word in rel_list[:]:
|
for word in rel_list[:]:
|
||||||
if not word:
|
if not word:
|
||||||
continue
|
continue
|
||||||
if word in _cousin_level:
|
if word.replace(' [styv]', '') in _cousin_level:
|
||||||
if item:
|
if item:
|
||||||
result.append(item)
|
result.append(item)
|
||||||
item = ""
|
item = ""
|
||||||
@ -116,8 +117,8 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
|||||||
result.append(item)
|
result.append(item)
|
||||||
gen_result = [ item + 's' for item in result[0:-1] ]
|
gen_result = [ item + 's' for item in result[0:-1] ]
|
||||||
gen_result = ' '.join(gen_result+result[-1:])
|
gen_result = ' '.join(gen_result+result[-1:])
|
||||||
if len(rel_list)>1 and step != '':
|
# Indicate step relations) by adding ' [styv]' if not already added.
|
||||||
# Indicate step relations) by adding ' [styv]'
|
if len(rel_list)>1 and step != '' and not gen_result.rfind(' [styv]'):
|
||||||
gen_result = gen_result + ' [styv]'
|
gen_result = gen_result + ' [styv]'
|
||||||
return gen_result
|
return gen_result
|
||||||
|
|
||||||
@ -517,8 +518,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
|||||||
# being in a lower generation from the common ancestor than the
|
# being in a lower generation from the common ancestor than the
|
||||||
# first person.
|
# first person.
|
||||||
rel_str = self._get_cousins_descendant(gender_b, reltocommon_b, reltocommon_a, step, inlaw)
|
rel_str = self._get_cousins_descendant(gender_b, reltocommon_b, reltocommon_a, step, inlaw)
|
||||||
# the replace method is to avoid double step indications. Can't figure out why.
|
return rel_str
|
||||||
return rel_str.replace (' [styv] [styv]', ' [styv]')
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user