Skip to content
Snippets Groups Projects
Commit 971ccfed authored by Kevin von Spiczak's avatar Kevin von Spiczak
Browse files

[BUGFIX] fix in queries when filling up with related jobs

parent 51025c0c
No related branches found
No related tags found
No related merge requests found
......@@ -286,13 +286,13 @@ class JobRepository extends Repository {
if ($resultCount < $minRelatedJobs) {
$queryResult = $query->execute()->toArray();
array_push($relatedJobs, ...$queryResult);
$query = $this->prepareRelatedJobsQuery($job, 1, $limit);
$query = $this->prepareRelatedJobsQuery($job, 1, $limit - $resultCount);
$queryResult = $query->execute()->toArray();
array_push($relatedJobs, ...$queryResult);
$relatedJobs = array_unique($relatedJobs);
$relatedJobsCount = count($relatedJobs);
if ($relatedJobsCount < $minRelatedJobs) {
$query = $this->prepareRelatedJobsQuery($job, 2, $limit);
$query = $this->prepareRelatedJobsQuery($job, 2, $limit - $relatedJobsCount);
$queryResult = $query->execute()->toArray();
array_push($relatedJobs, ...$queryResult);
$relatedJobs = array_unique($relatedJobs);
......@@ -313,7 +313,7 @@ class JobRepository extends Repository {
* @param int $limit
* @return QueryInterface
*/
protected function prepareRelatedJobsQuery(Job $job, int $iteration, $limit = 0): QueryInterface {
protected function prepareRelatedJobsQuery(Job $job, int $iteration, int $limit = 0): QueryInterface {
$query = $this->createQuery();
$constraints = [];
$storagePageIds = $query->getQuerySettings()->getStoragePageIds();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment