Compare commits

...

8 commits

Author SHA1 Message Date
Akinwale Ariwodola
f08049dc5c remove redundant code 2020-10-28 15:56:09 +01:00
Akinwale Ariwodola
ecbd1c82cf skip more claims query 2020-10-28 15:55:11 +01:00
Akinwale Ariwodola
4f49235511 add created_at to field list 2020-10-28 15:51:45 +01:00
Akinwale Ariwodola
179f9c9339 use publisher_id 2020-10-28 15:50:45 +01:00
Akinwale Ariwodola
c003a6b23a fix select field list 2020-10-28 15:43:38 +01:00
Akinwale Ariwodola
aad314491b additional check for claim publisher 2020-10-28 15:41:17 +01:00
Akinwale Ariwodola
b9fe194dc8 check publisher claim_id 2020-10-28 15:37:39 +01:00
Akinwale Ariwodola
15935ec109 fix CQ load when fetching more claims for a publishher 2020-10-28 15:23:28 +01:00

View file

@ -219,7 +219,15 @@ class MainController extends AppController {
$moreClaims = []; $moreClaims = [];
if (isset($claim->publisher) || $claim->claim_type == 1) { if (isset($claim->publisher) || $claim->claim_type == 1) {
// find more claims for the publisher // find more claims for the publisher
$moreClaims = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->where(['Claims.claim_type' => 1, 'Claims.id <>' => $claim->id, 'Claims.publisher_id' => isset($claim->publisher) ? $claim->publisher_id : $claim->claim_id])->limit(9)->order(['Claims.fee' => 'DESC', 'RAND()' => 'DESC'])->toArray(); $moreClaimsQuery = $this->Claims->find()->select([
'claim_id', 'bid_state', 'fee', 'fee_currency', 'is_nsfw', 'claim_type', 'name',
'title', 'description', 'content_type', 'language', 'author', 'license', 'content_type',
'created_at'
])->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->where(['Claims.claim_type' => 1, 'Claims.id <>' => $claim->id, 'Claims.publisher_id' => isset($claim->publisher) ? $claim->publisher_id : $claim->claim_id])->limit(9);
if (isset($claim->publisher) && $claim->publisher_id !== 'f2cf43b86b9d70175dc22dbb9ff7806241d90780') { // prevent ORDER BY for this particular claim
$moreClaimsQuery = $moreClaimsQuery->order(['Claims.fee' => 'DESC', 'RAND()' => 'DESC']);
$moreClaims = $moreClaimsQuery->toArray();
}
for ($i = 0; $i < count($moreClaims); $i++) { for ($i = 0; $i < count($moreClaims); $i++) {
if ($canConvert && $moreClaims[$i]->fee > 0 && $moreClaims[$i]->fee_currency == 'USD') { if ($canConvert && $moreClaims[$i]->fee > 0 && $moreClaims[$i]->fee_currency == 'USD') {
$moreClaims[$i]->price = $moreClaims[$i]->fee / $priceInfo->price; $moreClaims[$i]->price = $moreClaims[$i]->fee / $priceInfo->price;