ordering by fee then random to more claims by publisher

This commit is contained in:
Akinwale Ariwodola 2017-06-16 09:40:08 +01:00
parent c2ff1a5ccf
commit b53b71ebfc

View file

@ -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;