Merge pull request #805 from jessopb/moreBidState

checks bidstate on top-free claimnames
This commit is contained in:
Shawn K 2018-12-04 12:13:00 -06:00 committed by GitHub
commit 471930e0c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View file

@ -873,8 +873,7 @@ var claimQueries = (db, table, sequelize) => ({
logger$1.debug(`claim.getAllChannelClaims for ${channelClaimId}`);
const defaultWhereClauses = {
bid_state:
{ [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] }
bid_state: { [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] }
};
const addWhereClauses = (whereClauses, params) => {
@ -969,7 +968,7 @@ var claimQueries = (db, table, sequelize) => ({
getTopFreeClaimIdByClaimName: async (name) => {
return await table.findAll({
// TODO: Limit 1
where: { name },
where: { name, bid_state: { [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] } },
order: [['effective_amount', 'DESC'], ['height', 'ASC']],
}).then(result => {
if(result.length === 0) {

View file

@ -72,8 +72,7 @@ export default (db, table, sequelize) => ({
logger.debug(`claim.getAllChannelClaims for ${channelClaimId}`);
const defaultWhereClauses = {
bid_state:
{ [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] }
bid_state: { [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] }
};
const addWhereClauses = (whereClauses, params) => {
@ -168,7 +167,7 @@ export default (db, table, sequelize) => ({
getTopFreeClaimIdByClaimName: async (name) => {
return await table.findAll({
// TODO: Limit 1
where: { name },
where: { name, bid_state: { [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] } },
order: [['effective_amount', 'DESC'], ['height', 'ASC']],
}).then(result => {
if(result.length === 0) {