checks bidstate on top-free claimnames
This commit is contained in:
parent
267db2d614
commit
204686b690
2 changed files with 4 additions and 6 deletions
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue