checks bidstate on top-free claimnames

This commit is contained in:
jessop 2018-12-04 12:43:37 -05:00
parent 267db2d614
commit 204686b690
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) {