diff --git a/kjvstudy_org/server.py b/kjvstudy_org/server.py index 061897d..242efa1 100644 --- a/kjvstudy_org/server.py +++ b/kjvstudy_org/server.py @@ -3649,6 +3649,7 @@ def parse_gedcom_to_tree_data(gedcom_path): "description": description, "children": [], "parents": [], + "siblings": [], "spouse": None, "verses": all_verses, "birth_year": birth_year, @@ -3695,6 +3696,23 @@ def parse_gedcom_to_tree_data(gedcom_path): if wife_id not in tree_data[child_id]["parents"]: tree_data[child_id]["parents"].append(wife_id) + # Third pass: calculate siblings + # Siblings are people who share at least one parent + for person_id, person in tree_data.items(): + siblings_set = set() + + # Find all people who share a parent with this person + for parent_id in person["parents"]: + if parent_id in tree_data: + # Get all children of this parent + for sibling_id in tree_data[parent_id]["children"]: + # Don't include the person themselves + if sibling_id != person_id: + siblings_set.add(sibling_id) + + # Convert set to list and store + person["siblings"] = list(siblings_set) + # Calculate generations using BFS from root people (those with no parents) generations = {} for person_id, person in tree_data.items(): diff --git a/kjvstudy_org/templates/family_tree_person.html b/kjvstudy_org/templates/family_tree_person.html index 1d76f07..d5bf411 100644 --- a/kjvstudy_org/templates/family_tree_person.html +++ b/kjvstudy_org/templates/family_tree_person.html @@ -164,6 +164,26 @@ {% endif %} +{% if person.siblings|length > 0 %} +
+

Siblings ({{ person.siblings|length }})

+
+ {% for sibling_id in person.siblings %} + {% if sibling_id in family_tree_data %} +
+ {{ family_tree_data[sibling_id].name }} + {% if family_tree_data[sibling_id].generation or family_tree_data[sibling_id].age_at_death != "Unknown" %} + + {% if family_tree_data[sibling_id].generation %}generation {{ family_tree_data[sibling_id].generation }}{% endif %}{% if family_tree_data[sibling_id].age_at_death != "Unknown" %}{% if family_tree_data[sibling_id].generation %}, {% endif %}lived {{ family_tree_data[sibling_id].age_at_death }}{% endif %} + + {% endif %} +
+ {% endif %} + {% endfor %} +
+
+{% endif %} + {% if person.children|length > 0 %}

Children ({{ person.children|length }})