Skip to content

Commit

Permalink
Fixes and tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
dsblank committed Nov 16, 2024
1 parent ad0472c commit 5481af0
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 9 deletions.
10 changes: 8 additions & 2 deletions gramps/gen/filters/_genericfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@ def walk_filters(self, filter, parent_invert, result):
filter.logical_op,
len(rules),
)
result.append((parent_invert, filter.logical_op, rules))
result.append(
(
parent_invert if not filter.invert else not parent_invert,
filter.logical_op,
rules,
)
)

def apply_logical_op_to_all(
self, db, id_list, apply_logical_op, user=None, tupleind=None, tree=False
Expand All @@ -192,7 +198,7 @@ def intersection(sets):
# Optimiziation
# ------------------------------------------------------
all_maps = []
self.walk_filters(self, False, all_maps)
self.walk_filters(self, self.invert, all_maps)
LOG.debug("number of maps to consider: %s", len(all_maps))
handles = None
# Get all positive non-inverted maps
Expand Down
2 changes: 1 addition & 1 deletion gramps/gen/filters/rules/family/_hasevent.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class HasEvent(HasEventBase):

def apply_to_one(self, dbase, data):
family = self.get_object(data)
for event_ref in data["event_ref_list"]
for event_ref in data["event_ref_list"]:
if not event_ref:
continue
event_data = dbase.get_raw_event_data(event_ref["ref"])
Expand Down
1 change: 1 addition & 0 deletions gramps/gen/filters/rules/media/_hastag.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ class HasTag(HasTagBase):
labels = [_("Tag:")]
name = _("Media objects with the <tag>")
description = _("Matches media objects with the particular tag")
table = "media"
1 change: 1 addition & 0 deletions gramps/gen/filters/rules/note/_hastag.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ class HasTag(HasTagBase):
labels = [_("Tag:")]
name = _("Notes with the <tag>")
description = _("Matches notes with the particular tag")
table = "note"
12 changes: 7 additions & 5 deletions gramps/gen/filters/rules/person/_hasevent.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ def apply_to_one(self, db, data):
"""
Apply the rule. Return True if a match.
"""
person = self.get_object(data)
for event_ref in person.get_event_ref_list():
if int(self.list[5]) and event_ref.role != EventRoleType.PRIMARY:
for event_ref in data["event_ref_list"]:
if (
int(self.list[5])
and event_ref["role"]["value"] != EventRoleType.PRIMARY
):
# Only match primaries, no witnesses
continue
event = db.get_event_from_handle(event_ref.ref)
if HasEventBase.apply(self, db, event):
event_data = db.get_raw_event_data(event_ref["ref"])
if HasEventBase.apply_to_one(self, db, event_data):
return True
return False
1 change: 1 addition & 0 deletions gramps/gen/filters/rules/place/_hastag.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ class HasTag(HasTagBase):
labels = [_("Tag:")]
name = _("Places with the <tag>")
description = _("Matches places with the particular tag")
table = "place"
1 change: 1 addition & 0 deletions gramps/gen/filters/rules/repository/_hastag.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ class HasTag(HasTagBase):
labels = [_("Tag:")]
name = _("Repositories with the <tag>")
description = _("Matches repositories with the particular tag")
table = "repository"
1 change: 1 addition & 0 deletions gramps/gen/filters/rules/source/_hastag.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ class HasTag(HasTagBase):
labels = [_("Tag:")]
name = _("Sources with the <tag>")
description = _("Matches sources with the particular tag")
table = "source"
2 changes: 1 addition & 1 deletion gramps/gui/views/treemodels/placemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def column_name(self, data):
def search_name(self, data):
"""The search name includes all alt names to enable finding by alt name"""
return ",".join(
[data["name"]["value"]] + [name["value"] for name in data["alt_name"]]
[data["name"]["value"]] + [name["value"] for name in data["alt_names"]]
)

def column_longitude(self, data):
Expand Down

0 comments on commit 5481af0

Please sign in to comment.