Skip to content

Fix place filters ignoring event date in dated place hierarchies#2457

Open
dsblank wants to merge 1 commit into
gramps-project:maintenance/gramps61from
dsblank:fix/date-ranged-place-filter
Open

Fix place filters ignoring event date in dated place hierarchies#2457
dsblank wants to merge 1 commit into
gramps-project:maintenance/gramps61from
dsblank:fix/date-ranged-place-filter

Conversation

@dsblank

@dsblank dsblank commented Jul 4, 2026

Copy link
Copy Markdown
Member

Summary

Filter rules that match a Place by substring — HasBirth, HasDeath,
HasFamilyEvent, and the generic event filters (HasEventBase /
HasData) — resolved the displayed place name via
place_displayer.display(db, place) without passing the event's own
date. For places with date-ranged parent places (e.g.
Schleswig-Holstein was part of Denmark before 1865, Prussia from 1867
to 1871, and Germany after 1871), the hierarchy was resolved using
today's date rather than the event's date.

As a result, filtering People with the <birth data>: Place=Germany
would incorrectly match a person born in Schleswig-Holstein in 1854
(when it was part of Denmark), while filtering Place=Denmark would
miss that same person.

  • Pass event.date (or obj.date) into place_displayer.display() at
    all 5 affected call sites.
  • Add gramps/gen/filters/rules/test/dated_place_hierarchy_test.py,
    a self-contained regression test suite covering HasBirth,
    HasDeath, HasFamilyEvent, HasEvent, and HasData against a
    Schleswig-Holstein/Denmark/Prussia/Germany place hierarchy.

Fixes #0012092.

Test plan

  • New tests in dated_place_hierarchy_test.py pass with the fix
    and 5/6 fail against the pre-fix code (confirmed by reverting
    the fix locally and re-running).
  • black --check passes on all changed files.
  • mypy reports no new issues on changed files.

Filter rules that match a Place by substring (People with the <birth
data>, <death data>, family <event>, and generic event filters) built
the displayed place name without passing the event's own date to the
place displayer. When a place has multiple date-ranged parent places
(e.g. Schleswig-Holstein was part of Denmark before 1865, Prussia from
1867 to 1871, and Germany after 1871), the hierarchy was resolved
using today's date instead of the event's date, so filtering for the
historically correct country silently failed while filtering for the
modern country incorrectly matched.

Fixes #12092.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant