Incorrect grouping if no ma/patronymic surname

This commit is contained in:
SNoiraud 2021-08-11 10:09:41 +02:00 committed by Nick Hall
parent bfcbd38610
commit b52d90221f

View File

@ -999,6 +999,8 @@ class NameDisplay:
1. if group name is defined, use that 1. if group name is defined, use that
2. if group name is defined for the primary surname, use that 2. if group name is defined for the primary surname, use that
3. use primary surname itself otherwise 3. use primary surname itself otherwise
4. if no primary surname, do we have a ma/patronymic surname ?
in this case, group name will be the ma/patronymic name.
:param pn: raw unserialized data of name :param pn: raw unserialized data of name
:type pn: tuple :type pn: tuple
@ -1008,14 +1010,23 @@ class NameDisplay:
if pn[_GROUP]: if pn[_GROUP]:
return pn[_GROUP] return pn[_GROUP]
name = pn[_GROUP] name = pn[_GROUP]
if name == "": if not name:
# if we have no prinary surname, perhaps we have a # if we have no primary surname, perhaps we have a
# patronymic/matronynic name ? # patronymic/matronynic name ?
name = db.get_name_group_mapping(_raw_patro_surname_only( srnme = pn[_ORIGINPATRO]
pn[_ORIGINPATRO])) surname = []
for _surname in srnme:
if (_surname[_TYPE_IN_LIST][0] == _ORIGINPATRO
or _surname[_TYPE_IN_LIST][0] == _ORIGINMATRO):
# Yes, we have one.
surname = [_surname]
# name1 is the ma/patronymic name.
name1 = _raw_patro_surname_only(surname)
if name1 and len(srnme) == 1:
name = db.get_name_group_mapping(name1)
if not name: if not name:
name = db.get_name_group_mapping(_raw_primary_surname_only( name = db.get_name_group_mapping(_raw_primary_surname_only(
pn[_SURNAME_LIST])) pn[_SURNAME_LIST]))
return name return name
def _make_fn(self, format_str, d, args): def _make_fn(self, format_str, d, args):