diff --git a/src/models/Offer.js b/src/models/Offer.js index 4270b9e3..3a9e7b4f 100644 --- a/src/models/Offer.js +++ b/src/models/Offer.js @@ -167,6 +167,10 @@ OfferSchema.query.current = function() { return this.where(this.model.filterCurrent()); }; +OfferSchema.query.notPending= function(){ + return this.where({ isPending: false }); +} + /** * Currently active and non-hidden Offers */ diff --git a/src/services/company.js b/src/services/company.js index 394741b9..01558580 100644 --- a/src/services/company.js +++ b/src/services/company.js @@ -193,7 +193,7 @@ class CompanyService { async releaseOffers(companyId) { try { - await Offer.updateMany({ company : companyId }, { $set: { "isPending" : false } }); + await Offer.updateMany({ owner : companyId }, { $set: { "isPending" : false } }); } catch (err) { console.error(err); throw err; diff --git a/src/services/offer.js b/src/services/offer.js index badaf627..6dc747c6 100644 --- a/src/services/offer.js +++ b/src/services/offer.js @@ -222,7 +222,7 @@ class OfferService { } = this.decodeQueryToken(queryToken); [queryValue, queryFilters] = [searchInfo.value, searchInfo.filters]; - + offers = this._buildSearchContinuationQuery(lastOfferId, lastOfferScore, queryValue, showHidden, showAdminReason, queryFilters); } else { @@ -346,6 +346,7 @@ class OfferService { selectSearchOffers(offers, showHidden, showAdminReason) { offers.current(); + offers.notPending(); if (!showHidden) offers.withoutHidden(); if (!showAdminReason) offers.select("-adminReason");