diff --git a/api/serializers/bid.js b/api/serializers/bid.js index d9db354..198bcc8 100644 --- a/api/serializers/bid.js +++ b/api/serializers/bid.js @@ -16,7 +16,6 @@ const lotSerializer = require('./lot'); bidSerializer.formatBid = function (bid) { const formattedBid = _.pick(bid, ['isWinning', 'isSubcontracted', 'xYearApproximated']); - formattedBid.TEDCANID = bid.xTEDCANID; formattedBid.value = _.get(bid, 'price.netAmountEur') || undefined; formattedBid.xAmountApproximated = _.get(bid, 'price.xAmountApproximated'); return formattedBid; diff --git a/api/serializers/tender.js b/api/serializers/tender.js index 3197fae..47ffeaf 100644 --- a/api/serializers/tender.js +++ b/api/serializers/tender.js @@ -18,7 +18,6 @@ tenderSerializer.formatTender = function (tender) { const formattedTender = _.pick(tender, ['id', 'title', 'titleEnglish', 'description', 'sources', 'isCoveredByGpa', 'isFrameworkAgreement', 'procedureType', 'year', 'country', 'isDirective', 'xYearApproximated']); formattedTender.isEUFunded = tender.xIsEuFunded; - formattedTender.TEDCNID = tender.xTEDCNID; formattedTender.isDirective = tender.xIsDirective; formattedTender.finalValue = _.get(tender, 'finalPrice.netAmountEur') || undefined; formattedTender.xAmountApproximated = _.get(tender, 'finalPrice.xAmountApproximated'); diff --git a/api/swagger/swagger.yaml b/api/swagger/swagger.yaml index 9cd9f11..a069cc1 100644 --- a/api/swagger/swagger.yaml +++ b/api/swagger/swagger.yaml @@ -1556,9 +1556,6 @@ definitions: isWinning: type: boolean description: Did this bid won the lot? - TEDCANID: - type: string - description: ID of the Contract Award Notice on ted.europa.eu isSubcontracted: type: boolean description: Did the winner subcontract another company for this bid? @@ -1629,9 +1626,6 @@ definitions: items: type: string description: URL to tender source - TEDCNID: - type: string - description: ID of the Contract Notice on ted.europa.eu title: type: string description: Title of the tender diff --git a/extractors/bid.js b/extractors/bid.js index b822a9f..8128a8d 100644 --- a/extractors/bid.js +++ b/extractors/bid.js @@ -19,12 +19,6 @@ function extractBid(bidAttrs, tenderAttrs, lotAttrs) { robustPrice: priceExtractor.extractPrice(bidAttrs.robustPrice), xCountry: _.get(tenderAttrs, 'ot.country') || tenderAttrs.country, xYear: extractYear(lotAttrs.awardDecisionDate), - xTEDCANID: _ - .chain((tenderAttrs.publications || [])) - .filter({ formType: 'CONTRACT_AWARD' }) - .head() - .get('sourceId') - .value(), sources: extractSources(tenderAttrs.publications), }; } diff --git a/extractors/tender.js b/extractors/tender.js index 2c6c73e..6735ec1 100644 --- a/extractors/tender.js +++ b/extractors/tender.js @@ -23,10 +23,6 @@ function extractTender(tenderAttrs, indicators = [], publications = []) { indicators: _ .filter(indicators, { relatedEntityId: tenderAttrs.id }) .map((indicatorAttrs) => indicatorExtractor.extractIndicator(indicatorAttrs)), - xTEDCNID: _.get( - _.head(_.filter(publications, { formType: 'CONTRACT_NOTICE' })), - 'sourceId', - ), year: extractYear(publications), sources: extractSources(publications), }; diff --git a/migrations/m20200403_101942_remove_xTEDCNID_from_tender.js b/migrations/m20200403_101942_remove_xTEDCNID_from_tender.js new file mode 100644 index 0000000..1160dfb --- /dev/null +++ b/migrations/m20200403_101942_remove_xTEDCNID_from_tender.js @@ -0,0 +1,19 @@ +"use strict"; +exports.name = "remove xTEDCNID from tender"; + + +exports.up = (db) => ( + db.class.get('Tender') + .then((Tender) => Tender.property.drop('xTEDCNID')) +); + +exports.down = (db) => ( + db.class.get('Tender') + .then((Tender) => + Tender.property.create([ + { + name: 'xTEDCNID', + type: 'String', + }, + ])) +); diff --git a/migrations/m20200403_103410_remove_xTEDCANID_from_Bid.js b/migrations/m20200403_103410_remove_xTEDCANID_from_Bid.js new file mode 100644 index 0000000..356d78c --- /dev/null +++ b/migrations/m20200403_103410_remove_xTEDCANID_from_Bid.js @@ -0,0 +1,18 @@ +"use strict"; +exports.name = "remove xTEDCANID from Bid"; + +exports.up = (db) => ( + db.class.get('Bid') + .then((Bid) => Bid.property.drop('xTEDCANID')) +); + +exports.down = (db) => ( + db.class.get('Bid') + .then((Bid) => + Bid.property.create([ + { + name: 'xTEDCANID', + type: 'String', + }, + ])) +); diff --git a/test/extractors/bid.js b/test/extractors/bid.js index 10bc449..e6a1a4e 100644 --- a/test/extractors/bid.js +++ b/test/extractors/bid.js @@ -5,29 +5,6 @@ const test = require('ava'); const bidExtractor = require('./../../extractors/bid'); const fixtures = require('./../fixtures'); -test('extractBid extracts contract award notice id from publications', async (t) => { - const publication = await fixtures.build('rawContractAwardNotice'); - const rawBid = await fixtures.build('rawBid'); - const rawTender = await fixtures.build('rawTender', { - publications: [publication], - }); - t.is( - bidExtractor.extractBid(rawBid, rawTender, {}).xTEDCANID, - publication.sourceId, - ); -}); - -test('extractBid returns null if there is no publication', async (t) => { - const rawBid = await fixtures.build('rawBid'); - const rawTender = await fixtures.build('rawTender', { - publications: [], - }); - t.is( - bidExtractor.extractBid(rawBid, rawTender, {}).xTEDCANID, - undefined, - ); -}); - test('extractBid extracts year from lots award decision date', async (t) => { const rawBid = await fixtures.build('rawBid'); const year = 2015; diff --git a/test/extractors/tender.js b/test/extractors/tender.js index 6cc9c4e..212a93a 100644 --- a/test/extractors/tender.js +++ b/test/extractors/tender.js @@ -6,23 +6,6 @@ const test = require('ava'); const tenderExtractor = require('./../../extractors/tender'); const fixtures = require('./../fixtures'); -test('extractTender extracts contract notice id from publications', async (t) => { - const publication = await fixtures.build('rawContractNotice'); - const rawTender = await fixtures.build('rawTender'); - t.is( - tenderExtractor.extractTender(rawTender, [], [publication]).xTEDCNID, - publication.sourceId, - ); -}); - -test('extractTender returns null if there is no publication', async (t) => { - const rawTender = await fixtures.build('rawTender'); - t.is( - tenderExtractor.extractTender(rawTender, [], []).xTEDCNID, - undefined, - ); -}); - test('extractTender extracts sources from contract notice publications', async (t) => { const publication = await fixtures.build('rawContractNotice'); const rawTender = await fixtures.build('rawTender');