summaryrefslogtreecommitdiff
path: root/app/Services/ChartService.php
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2021-02-27 10:38:10 +0000
committerGreg Roach <greg@subaqua.co.uk>2021-02-28 11:05:33 +0000
commit9bbda1e6be2ef66109d81aba7b0e242a0f110846 (patch)
tree1124b509ae2d36f9924ab3149c55dbc7ebe79800 /app/Services/ChartService.php
parent44ba5f4d1ce8d86be1ff765fa220575942d84d57 (diff)
downloadwebtrees-9bbda1e6be2ef66109d81aba7b0e242a0f110846.tar.gz
webtrees-9bbda1e6be2ef66109d81aba7b0e242a0f110846.tar.bz2
webtrees-9bbda1e6be2ef66109d81aba7b0e242a0f110846.zip
Code style
Diffstat (limited to 'app/Services/ChartService.php')
-rw-r--r--app/Services/ChartService.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/Services/ChartService.php b/app/Services/ChartService.php
index 5b78e8921c..e43eb8761e 100644
--- a/app/Services/ChartService.php
+++ b/app/Services/ChartService.php
@@ -79,12 +79,14 @@ class ChartService
*/
public function descendants(Individual $individual, int $generations): Collection
{
- $descendants = new Collection([$individual]);
+ $descendants = new Collection([$individual->xref() => $individual]);
if ($generations > 0) {
foreach ($individual->spouseFamilies() as $family) {
foreach ($family->children() as $child) {
- $descendants = $descendants->merge($this->descendants($child, $generations - 1));
+ if (!$descendants->has($child->xref())) {
+ $descendants = $descendants->merge($this->descendants($child, $generations - 1));
+ }
}
}
}