Fix SQL for previews

This commit is contained in:
Thomas Zarebczan 2020-08-12 08:59:31 -04:00 committed by GitHub
parent b14f3c87f1
commit e092ae3231
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,7 +40,7 @@ module.exports.getClaim = async function getClaim(claimName, claimId, channelNam
params.push(claimId + '%');
}
sql += ' AND claim.bid_state in ("controlling", "active", "accepted") ORDER BY claim.bid_state desc';
sql += ' AND claim.bid_state in ("controlling", "active", "accepted")';
if (claimName[0] !== '@' && channelName) {
sql += ' AND channel_claim.name = ?';
@ -49,11 +49,11 @@ module.exports.getClaim = async function getClaim(claimName, claimId, channelNam
sql += ' AND channel_claim.claim_id LIKE ?';
params.push(channelClaimId + '%');
} else {
sql += ' AND channel_claim.bid_state in ("controlling", "active", "accepted") ORDER BY channel_claim.bid_state desc';
sql += ' AND channel_claim.bid_state in ("controlling", "active", "accepted")';
}
}
sql += ' LIMIT 1';
sql += ' ORDER BY claim.bid_state DESC LIMIT 1';
return queryPool(sql, params);
};