2006-06-06 Alex Roitman <shura@gramps-project.org>

* src/GrampsDb/_DbUtils.py (set_birth_death_index): Only set birth
	and death references for events with primary role.



svn: r6866
This commit is contained in:
Alex Roitman 2006-06-06 18:49:34 +00:00
parent 4e5ff5a16a
commit c1f1b1723a
2 changed files with 20 additions and 12 deletions

View File

@ -1,3 +1,7 @@
2006-06-06 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_DbUtils.py (set_birth_death_index): Only set birth
and death references for events with primary role.
2006-06-05 Don Allingham <don@gramps-project.org> 2006-06-05 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadGedcom.py: more improvements * src/GrampsDb/_ReadGedcom.py: more improvements

View File

@ -274,16 +274,20 @@ def update_secondary_inmem(sec_table,handle,data):
sec_table[str(data[1])] = str(handle) sec_table[str(data[1])] = str(handle)
def set_birth_death_index(db, person): def set_birth_death_index(db, person):
birth = -1 birth_ref_index = -1
death = -1 death_ref_index = -1
index = 0 event_ref_list = person.get_event_ref_list()
for ref in person.get_event_ref_list(): for index in range(len(event_ref_list)):
ref = event_ref_list[index]
event = db.get_event_from_handle(ref.ref) event = db.get_event_from_handle(ref.ref)
if int(event.get_type()) == RelLib.EventType.BIRTH and birth == -1: if (int(event.get_type()) == RelLib.EventType.BIRTH) \
birth = index and (int(ref.get_role()) == RelLib.EventRoleType.PRIMARY) \
elif int(event.get_type()) == RelLib.EventType.DEATH and death == -1: and (birth_ref_index == -1):
death = index birth_ref_index = index
index += 1 elif (int(event.get_type()) == RelLib.EventType.DEATH) \
person.birth_ref_index = birth and (int(ref.get_role()) == RelLib.EventRoleType.PRIMARY) \
person.death_ref_index = death and (death_ref_index == -1):
death_ref_index = index
person.birth_ref_index = birth_ref_index
person.death_ref_index = death_ref_index