From bfcbd386105c14eb4ef0697ca873689ae54ef09c Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Sat, 7 Aug 2021 13:36:33 +0200 Subject: [PATCH 1/2] Group As override is ignored for ma/patronymic surnames Fixes #12395 discourse: https://gramps.discourse.group/t/patronymic-and-matronymic-name/1684/5 --- gramps/gen/display/name.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gramps/gen/display/name.py b/gramps/gen/display/name.py index 1555a2dcb..4d0636df8 100644 --- a/gramps/gen/display/name.py +++ b/gramps/gen/display/name.py @@ -1007,8 +1007,16 @@ class NameDisplay: """ if pn[_GROUP]: return pn[_GROUP] - return db.get_name_group_mapping(_raw_primary_surname_only( + name = pn[_GROUP] + if name == "": + # if we have no prinary surname, perhaps we have a + # patronymic/matronynic name ? + name = db.get_name_group_mapping(_raw_patro_surname_only( + pn[_ORIGINPATRO])) + if not name: + name = db.get_name_group_mapping(_raw_primary_surname_only( pn[_SURNAME_LIST])) + return name def _make_fn(self, format_str, d, args): """ From b52d90221f87e635c8185cdba204a8fad83a33ad Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Wed, 11 Aug 2021 10:09:41 +0200 Subject: [PATCH 2/2] Incorrect grouping if no ma/patronymic surname --- gramps/gen/display/name.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/gramps/gen/display/name.py b/gramps/gen/display/name.py index 4d0636df8..676fdb30e 100644 --- a/gramps/gen/display/name.py +++ b/gramps/gen/display/name.py @@ -999,6 +999,8 @@ class NameDisplay: 1. if group name is defined, use that 2. if group name is defined for the primary surname, use that 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 :type pn: tuple @@ -1008,14 +1010,23 @@ class NameDisplay: if pn[_GROUP]: return pn[_GROUP] name = pn[_GROUP] - if name == "": - # if we have no prinary surname, perhaps we have a + if not name: + # if we have no primary surname, perhaps we have a # patronymic/matronynic name ? - name = db.get_name_group_mapping(_raw_patro_surname_only( - pn[_ORIGINPATRO])) + srnme = 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: name = db.get_name_group_mapping(_raw_primary_surname_only( - pn[_SURNAME_LIST])) + pn[_SURNAME_LIST])) return name def _make_fn(self, format_str, d, args):