Skip to content

Commit

Permalink
Show the number of families in the facts page
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Jul 17, 2024
1 parent add3e8e commit 7b24242
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
27 changes: 16 additions & 11 deletions dynamic-site/templates/en/mobile/Ged2site/Display/facts.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,30 @@
[% END %]
[% IF facts %]
<p>
There are [% facts.count %] people in the tree,
There are [% facts.number_of_individuals %] people in the tree,
of which [% facts.sex.M %] are male and [% facts.sex.F %] are female.
IF [% facts.sex.U %]
There are also [% facts.sex.U %] people for which the sex is unknown.
[% END %]
</p>
[% IF facts.fathers_side %]
<p>
There are [% facts.fathers_side.count %] adults known to have lived to 20 or over on the father's side,
[% IF facts.number_of_families %]
<p>
There are [% facts.number_of_families %] families in the tree.
</p>
[% END %]
[% IF facts.fathers_side %]
<p>
There are [% facts.fathers_side.count %] adults known to have lived to 20 or over on the father's side,
of which the average (mean) age at death was [% Math.int(facts.fathers_side.age / facts.fathers_side.count) %].

</p>
[% END %]
[% IF facts.mothers_side %]
<p>
There are [% facts.mothers_side.count %] adults known to have lived to 20 or over on the mother's side,
</p>
[% END %]
[% IF facts.mothers_side %]
<p>
There are [% facts.mothers_side.count %] adults known to have lived to 20 or over on the mother's side,
of which the average (mean) age at death was [% Math.int(facts.mothers_side.age / facts.mothers_side.count) %].
</p>
[% END %]
</p>
[% END %]
[% IF facts.first_birth %]
<p>
First person in the tree:
Expand Down
7 changes: 6 additions & 1 deletion dynamic-site/templates/en/search/Ged2site/Display/facts.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@
</center>
[% IF facts %]
<p>
There are [% facts.count %] people in the tree,
There are [% facts.number_of_individuals %] people in the tree,
of which [% facts.sex.M %] are male and [% facts.sex.F %] are female.
IF [% facts.sex.U %]
There are also [% facts.sex.U %] people for which the sex is unknown.
[% END %]
</p>
[% IF facts.number_of_families %]
<p>
There are [% facts.number_of_families %] families in the tree.
</p>
[% END %]
[% IF facts.fathers_side %]
<p>
There are [% facts.fathers_side.count %] adults known to have lived to 20 or over on the father's side,
Expand Down
7 changes: 6 additions & 1 deletion dynamic-site/templates/en/web/Ged2site/Display/facts.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@
[% IF facts %]
<ul>
<li>
There are [% facts.count %] people in the tree,
There are [% facts.number_of_individuals %] people in the tree,
of which [% facts.sex.M %] are male and [% facts.sex.F %] are female.
[% IF facts.sex.U %]
There are also [% facts.sex.U %] people for which the sex is unknown.
[% END %]
</li>
[% IF facts.number_of_families %]
<li>
There are [% facts.number_of_families %] families in the tree.
</li>
[% END %]
[% IF facts.fathers_side %]
<li>
There are [% facts.fathers_side.count %] adults known to have lived to 20 or over on the father's side,
Expand Down
6 changes: 6 additions & 0 deletions ged2site
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,12 @@ if($opts{'w'}) {
close $html;
}

if($facts) {
my @fams = $ged->families();
$facts->{'number_of_families'} = scalar(@fams);
$facts->{'number_of_individuals'} = $facts->{'count'}; # TODO: replace count with number of individuals
}

$ged = undef;
@everyone = undef;

Expand Down

0 comments on commit 7b24242

Please sign in to comment.