From b53b71ebfc6efc99bdcaa9cda5abab8cb1ff2bbc Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 16 Jun 2017 09:40:08 +0100 Subject: [PATCH] ordering by fee then random to more claims by publisher --- src/Controller/MainController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index e4e43ae..4b99045 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -160,7 +160,7 @@ class MainController extends AppController { // find more claims for the publisher $moreClaims = $this->Claims->find()->contain(['Stream', 'Publisher' => ['fields' => ['Name']]])-> where(['Claims.ClaimType' => 2, 'Claims.Id <>' => $claim->Id, 'Claims.PublisherId' => isset($claim->Publisher) ? $claim->Publisher->ClaimId : $claim->ClaimId])-> - limit(9)->order(['RAND()' => 'DESC', 'Claims.Fee' => 'DESC'])->toArray(); + limit(9)->order(['Claims.Fee' => 'DESC', 'RAND()' => 'DESC'])->toArray(); for ($i = 0; $i < count($moreClaims); $i++) { if ($canConvert && $moreClaims[$i]->Fee > 0 && $moreClaims[$i]->FeeCurrency == 'USD') { $moreClaims[$i]->Price = $moreClaims[$i]->Fee / $priceInfo->price;