- Issue created by @Mehrdad201
- 🇮🇷Iran Mehrdad201
I found that problem happened because pf getRandomAd function.
getRandomAd function located at AdContentBucket.php only same the first item of each size and it seems random selector doesn't work.
because every time after running the bellow code
$result = $query ->range(0, 1) ->sort('id') ->execute();
the first record of selected size is received and loaded to ad_content variable.
I changed the code and now it works but I am not sure that what I have done is true or false.
here is my changed code:
$result = $query //->range(0, 1) ->sort('id') ->execute(); if ($result) { shuffle($result) /** @var \Drupal\ad_content\Entity\AdContentInterface $ad_content */ $ad_content = $storage->load(reset($result)); }
- Assigned to lrwebks
- 🇩🇪Germany lrwebks Porta Westfalica
This is correct and fixed in 11.x after 📌 [META] 11.x feature updates Active is merged!
- 🇩🇪Germany Anybody Porta Westfalica
Fixed in 📌 [META] 11.x feature updates Active by using SQL random :)
If this is still an issue, it will be a caching one, I think.
Automatically closed - issue fixed for 2 weeks with no activity.