vytux-com/vytux_cousins

Mobile display problem

ardhtu opened this issue · 8 comments

Only father side cousins are shown in the narrow (<600px) display.
I did a quick fix for myself: line 56 in vytux_cousins.css to display: table-cell; did fix it but the resulting tables are extremely narrow. It would be better if the tables were one below the other.

  • Hannu

Can you tell me what version of webtrees and the module you are using.

I just checked and on my site on small screens it already shows mother's families below father's

Maybe even attach a screenshot of the problem if possible

Hi,
Thanks for quick reply. I'm using the latest webtrees 2.0.11, browser is Firefox (but I tried also Chrome). I couldn't find the cousins version info but the date is 27.1.2020
Here is a screenshot of mobile dispaly (in finnish, sorry).
This lady has 64 cousins of which only father's side 10 people are shown:
image

  • Hannu

More info,
I updated to the latest version 2.0.1 but with same results.
There is however some bugs in the function that collects cousins from the db so I fixed that for my own use. That shoud be the only difference campred to git master.
It did not find half-cousins (from grandparents other marriages) and it listed twice cousins that came both from father's and mother's side.
Here is the modified code snippet:
`private function getCousins(Individual $individual): object
{
$cousinsObj = (object)[];
$cousinsObj->self = $individual;
$cousinsObj->fathersCousinCount = 0;
$cousinsObj->mothersCousinCount = 0;
$cousinsObj->allCousinCount = 0;
$cousinsObj->fatherCousins = [];
$cousinsObj->motherCousins = [];
if ($individual->childFamilies()->first()) {
$cousinsObj->father = $individual->childFamilies()->first()->husband();
$cousinsObj->mother = $individual->childFamilies()->first()->wife();

        if ($cousinsObj->father) {
           foreach ($cousinsObj->father->childFamilies() as $family) {
              foreach ($family->spouses() as $parent) {
                 foreach ($parent->spouseFamilies() as $family2) {
                    foreach ($family2->children() as $sibling) {
                       if ($sibling !== $cousinsObj->father) {
                          foreach ($sibling->spouseFamilies() as $fam) {
                             foreach ($fam->children() as $child) {
                                $cousinsObj->fatherCousins[] = $child;
                                $cousinsObj->fathersCousinCount++;
                             }
                          }
                       }
                    }
                 }
              }
           }
        }
        $cousinsObj->fatherCousins = array_unique( $cousinsObj->fatherCousins );
        $cousinsObj->fathersCousinCount = sizeof( $cousinsObj->fatherCousins );

        if ($cousinsObj->mother) {
           foreach ($cousinsObj->mother->childFamilies() as $family) {
              foreach ($family->spouses() as $parent) {
                 foreach ($parent->spouseFamilies() as $family2) {
                    foreach ($family2->children() as $sibling) {
                       if ($sibling !== $cousinsObj->mother) {
                          foreach ($sibling->spouseFamilies() as $fam) {
                             foreach ($fam->children() as $child) {
								if ( in_array( $child, $cousinsObj->fatherCousins )){} else {
                                   $cousinsObj->motherCousins[] = $child;
                                   $cousinsObj->mothersCousinCount++;
								}
                             }
                          }
                       }
                    }
                 }
              }
           } 
        }
        $cousinsObj->motherCousins = array_unique( $cousinsObj->motherCousins );
        $cousinsObj->mothersCousinCount = sizeof( $cousinsObj->motherCousins );

        $cousinsObj->allCousinCount = sizeof(array_unique(array_merge($cousinsObj->fatherCousins,$cousinsObj->motherCousins)));
    }

    return $cousinsObj;
}

`

Yes, I will need to upgrade my webtrees site to see if that is the cause of this issue.

image
Still looks ok on my site in webtrees 2.0.13

Could it be a conflict with some other custom module or theme?

I'll close this one as it seems to be a browser issue in Firefox. Hopefully something that Firefox dev might have overlooked in that version.