checks bidstate on top-free claimnames #805
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}`);
|
logger$1.debug(`claim.getAllChannelClaims for ${channelClaimId}`);
|
||||||
|
|
||||||
const defaultWhereClauses = {
|
const defaultWhereClauses = {
|
||||||
bid_state:
|
bid_state: { [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] }
|
||||||
{ [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const addWhereClauses = (whereClauses, params) => {
|
const addWhereClauses = (whereClauses, params) => {
|
||||||
|
@ -969,7 +968,7 @@ var claimQueries = (db, table, sequelize) => ({
|
||||||
getTopFreeClaimIdByClaimName: async (name) => {
|
getTopFreeClaimIdByClaimName: async (name) => {
|
||||||
return await table.findAll({
|
return await table.findAll({
|
||||||
// TODO: Limit 1
|
// TODO: Limit 1
|
||||||
where: { name },
|
where: { name, bid_state: { [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] } },
|
||||||
order: [['effective_amount', 'DESC'], ['height', 'ASC']],
|
order: [['effective_amount', 'DESC'], ['height', 'ASC']],
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
if(result.length === 0) {
|
if(result.length === 0) {
|
||||||
|
|
|
@ -72,8 +72,7 @@ export default (db, table, sequelize) => ({
|
||||||
logger.debug(`claim.getAllChannelClaims for ${channelClaimId}`);
|
logger.debug(`claim.getAllChannelClaims for ${channelClaimId}`);
|
||||||
|
|
||||||
const defaultWhereClauses = {
|
const defaultWhereClauses = {
|
||||||
bid_state:
|
bid_state: { [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] }
|
||||||
{ [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const addWhereClauses = (whereClauses, params) => {
|
const addWhereClauses = (whereClauses, params) => {
|
||||||
|
@ -168,7 +167,7 @@ export default (db, table, sequelize) => ({
|
||||||
getTopFreeClaimIdByClaimName: async (name) => {
|
getTopFreeClaimIdByClaimName: async (name) => {
|
||||||
return await table.findAll({
|
return await table.findAll({
|
||||||
// TODO: Limit 1
|
// TODO: Limit 1
|
||||||
where: { name },
|
where: { name, bid_state: { [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] } },
|
||||||
order: [['effective_amount', 'DESC'], ['height', 'ASC']],
|
order: [['effective_amount', 'DESC'], ['height', 'ASC']],
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
if(result.length === 0) {
|
if(result.length === 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue