diff --git a/8/ecolyo.c7b053d03ca1a7f2eeea.js b/8/ecolyo.a9363dc7eb1de5bcc528.js similarity index 98% rename from 8/ecolyo.c7b053d03ca1a7f2eeea.js rename to 8/ecolyo.a9363dc7eb1de5bcc528.js index 33e05a9512bc03ddfdebf401fa2207c4f58d2be5..a7276e9c0cd7adc6e8b22f862e7f9a0e3d6069fe 100644 --- a/8/ecolyo.c7b053d03ca1a7f2eeea.js +++ b/8/ecolyo.a9363dc7eb1de5bcc528.js @@ -143,7 +143,7 @@ var EnedisMonthlyAnalysisDataService = /*#__PURE__*/function () { while (1) { switch (_context2.prev = _context2.next) { case 0: - query = (0, _cozyClient.Q)(_doctypes.ENEDIS_MONTHLY_ANALYSIS_DATA_DOCTYPE).where({}).sortBy([{ + query = (0, _cozyClient.Q)(_doctypes.ENEDIS_MONTHLY_ANALYSIS_DATA_DOCTYPE).where({}).indexFields(['year', 'month']).sortBy([{ year: 'desc' }, { month: 'desc' @@ -194,7 +194,7 @@ var EnedisMonthlyAnalysisDataService = /*#__PURE__*/function () { query = (0, _cozyClient.Q)(_doctypes.ENEDIS_MONTHLY_ANALYSIS_DATA_DOCTYPE).where({ year: year, month: month - }).sortBy([{ + }).indexFields(['year', 'month']).sortBy([{ year: 'desc' }, { month: 'desc' @@ -289,7 +289,7 @@ var EnedisMonthlyAnalysisDataService = /*#__PURE__*/function () { query = (0, _cozyClient.Q)(_doctypes.ENEDIS_MAXPOWER_DOCTYPE).where({ year: year, month: month - }).sortBy([{ + }).indexFields(['year', 'month']).sortBy([{ year: 'desc' }, { month: 'desc' diff --git a/app/ecolyo.dcd5fbf6b807f8613a93.js b/app/ecolyo.606ae9e3c79d5f7d3766.js similarity index 99% rename from app/ecolyo.dcd5fbf6b807f8613a93.js rename to app/ecolyo.606ae9e3c79d5f7d3766.js index d9aafcc6ce99b29f11bc4efb18773cdcb0bf0e89..bfb9d6d65b47ba902e46da2b4b72677cb60df97a 100644 --- a/app/ecolyo.dcd5fbf6b807f8613a93.js +++ b/app/ecolyo.606ae9e3c79d5f7d3766.js @@ -64,7 +64,7 @@ /******/ /******/ // script path function /******/ function jsonpScriptSrc(chunkId) { -/******/ return __webpack_require__.p + "" + ({}[chunkId]||chunkId) + "/ecolyo." + {"1":"c44aefc530d1de68ee3f","3":"d2df4032b01652f39d0a","4":"c5391e9a8b4de18cce66","5":"342b80dc40a66b9042b7","6":"bbfb6bfe9fecbfa83e16","7":"6c533b265fd43b5164be","8":"c7b053d03ca1a7f2eeea","9":"4facae32c2f3722bac49","10":"e8a00fc8bc16cb5a9dfd"}[chunkId] + ".js" +/******/ return __webpack_require__.p + "" + ({}[chunkId]||chunkId) + "/ecolyo." + {"1":"c44aefc530d1de68ee3f","3":"d2df4032b01652f39d0a","4":"c5391e9a8b4de18cce66","5":"342b80dc40a66b9042b7","6":"bbfb6bfe9fecbfa83e16","7":"6c533b265fd43b5164be","8":"a9363dc7eb1de5bcc528","9":"4facae32c2f3722bac49","10":"e8a00fc8bc16cb5a9dfd"}[chunkId] + ".js" /******/ } /******/ /******/ // The require function @@ -608,8 +608,6 @@ var _tracing = __webpack_require__("aI3+"); var _cozyClient = _interopRequireWildcard(__webpack_require__("SH7X")); -var _cozyDeviceHelper = __webpack_require__("snfs"); - var _oauth = __webpack_require__("sDS3"); var _cozyIntent = __webpack_require__("qvEe"); @@ -686,7 +684,7 @@ var setupApp = (0, _lodash.memoize)(function () { replaceTitleOnMobile: false, appSlug: data.app.slug, appNamePrefix: data.app.prefix, - isInvertedTheme: (0, _cozyDeviceHelper.isFlagshipApp)() + isInvertedTheme: true }); var tracker; @@ -9932,7 +9930,7 @@ var ConsumptionDataManager = /*#__PURE__*/function () { while (1) { switch (_context11.prev = _context11.next) { case 0: - query = (0, _cozyClient.Q)(doctype).where({}).sortBy([{ + query = (0, _cozyClient.Q)(doctype).where({}).indexFields(['year', 'month']).sortBy([{ year: 'asc' }, { month: 'asc' @@ -9968,8 +9966,11 @@ var ConsumptionDataManager = /*#__PURE__*/function () { switch (_context12.prev = _context12.next) { case 0: query = (0, _cozyClient.Q)(doctype).where({ - price: { - $exists: false + year: { + $gt: null + }, + month: { + $gt: null } }).partialIndex({ price: { @@ -18053,14 +18054,14 @@ var QueryRunner = /*#__PURE__*/function () { var doctype = this.getRelevantDoctype(fluidType, timeStep); if (timeStep === _timeStep.TimeStep.HALF_AN_HOUR) { - return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, _timeStep.TimeStep.HALF_AN_HOUR)).indexFields(['load']).limitBy(1).sortBy([{ + return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, _timeStep.TimeStep.HALF_AN_HOUR)).indexFields(['load']).sortBy([{ load: 'desc' - }]); + }]).limitBy(1); } - return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, timeStep)).indexFields(['load']).limitBy(limit).sortBy([{ + return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, timeStep)).indexFields(['load']).sortBy([{ load: 'desc' - }]); + }]).limitBy(limit); } }, { key: "buildFirstDateQuery", @@ -18615,7 +18616,7 @@ var QueryRunner = /*#__PURE__*/function () { case 0: doctype = this.getRelevantDoctype(fluidType, timeStep); _context7.prev = 1; - query = (0, _cozyClient.Q)(doctype).where({}).limitBy(1); + query = (0, _cozyClient.Q)(doctype).limitBy(1); _context7.next = 5; return this._client.query(query); @@ -20612,14 +20613,14 @@ var FluidPricesService = /*#__PURE__*/function () { while (1) { switch (_context2.prev = _context2.next) { case 0: - query = (0, _cozyClient.Q)(_doctypes.FLUIDSPRICES_DOCTYPE).indexFields(['startDate']).where({ + query = (0, _cozyClient.Q)(_doctypes.FLUIDSPRICES_DOCTYPE).where({ startDate: { $lte: date.toISO({ suppressMilliseconds: true }).toString() }, fluidType: fluidType - }).sortBy([{ + }).indexFields(['startDate']).sortBy([{ startDate: 'desc' }]).limitBy(1); _context2.next = 3; @@ -20659,11 +20660,11 @@ var FluidPricesService = /*#__PURE__*/function () { while (1) { switch (_context3.prev = _context3.next) { case 0: - query = (0, _cozyClient.Q)(_doctypes.FLUIDSPRICES_DOCTYPE).indexFields(['fluidType']).where({ + query = (0, _cozyClient.Q)(_doctypes.FLUIDSPRICES_DOCTYPE).where({ endDate: { $eq: '' } - }).sortBy([{ + }).indexFields(['fluidType']).sortBy([{ fluidType: 'asc' }]).limitBy(3); _context3.next = 3; @@ -23953,7 +23954,7 @@ var ProfileTypeEntityService = /*#__PURE__*/function () { updateDate: { $lte: date.toString() } - }).sortBy([{ + }).indexFields(['updateDate']).sortBy([{ updateDate: 'desc' }]).limitBy(1)); @@ -24009,11 +24010,7 @@ var ProfileTypeEntityService = /*#__PURE__*/function () { case 29: _context.next = 31; - return this._client.query(query.where({ - _id: { - $gt: null - } - }).sortBy([{ + return this._client.query(query.where({}).indexFields(['updateDate']).sortBy([{ updateDate: 'desc' }]).limitBy(1)); @@ -24079,7 +24076,7 @@ var ProfileTypeEntityService = /*#__PURE__*/function () { updateDate: { $gte: timePeriod.startDate.toString() } - }).sortBy([{ + }).indexFields(['updateDate']).sortBy([{ updateDate: 'asc' }]).limitBy(100)); @@ -25512,10 +25509,11 @@ var UsageEventService = /*#__PURE__*/function () { _context3.prev = 0; // Get last Connection attempt Event query = (0, _cozyClient.Q)(_doctypes.USAGEEVENT_DOCTYPE).where({ + target: konnectorSlug + }).partialIndex({ type: _usageEvent.UsageEventType.KONNECTOR_ATTEMPT_EVENT, - target: konnectorSlug, result: 'error' - }).sortBy([{ + }).indexFields(['eventDate', 'type']).sortBy([{ eventDate: 'desc' }]).limitBy(1); _context3.next = 4; @@ -35896,15 +35894,15 @@ var EcogestureService = /*#__PURE__*/function () { season: { $ne: seasonFilter } - }).sortBy([{ + }).indexFields(['season']).sortBy([{ season: 'desc' }]); } else if (orderByID) { - query = query.where({}).sortBy([{ + query = query.where({}).indexFields(['_id']).sortBy([{ _id: 'asc' }]); } else { - query = query.where({}).sortBy([{ + query = query.where({}).indexFields(['season']).sortBy([{ season: 'desc' }]); } @@ -35926,7 +35924,7 @@ var EcogestureService = /*#__PURE__*/function () { season: { $eq: seasonFilter } - }).sortBy([{ + }).indexFields(['season']).sortBy([{ season: 'asc' }])); @@ -36425,7 +36423,7 @@ var TermsService = /*#__PURE__*/function () { while (1) { switch (_context.prev = _context.next) { case 0: - query = (0, _cozyClient.Q)(_doctypes.TERMS_DOCTYPE).where({}).sortBy([{ + query = (0, _cozyClient.Q)(_doctypes.TERMS_DOCTYPE).where({}).indexFields(['acceptedAt']).sortBy([{ acceptedAt: 'desc' }]).limitBy(1); _context.next = 3; @@ -36466,7 +36464,7 @@ var TermsService = /*#__PURE__*/function () { while (1) { switch (_context2.prev = _context2.next) { case 0: - query = (0, _cozyClient.Q)(_doctypes.TERMS_DOCTYPE).where({}).sortBy([{ + query = (0, _cozyClient.Q)(_doctypes.TERMS_DOCTYPE).where({}).indexFields(['acceptedAt']).sortBy([{ acceptedAt: 'desc' }]).limitBy(1); _context2.next = 3; diff --git a/index.html b/index.html index d3d3c162171a279c34bd1f69798b4c95154b52d9..981e66cf4fbcd4863847657c04da9c3f6ca6bda4 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -<!DOCTYPE html><html lang="{{.Locale}}"><head><meta charset="utf-8"><title>Ecolyo</title><link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"><link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"><!-- PWA Manifest --><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#297EF2"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,viewport-fit=cover"><!-- PWA Chrome --><link rel="icon" sizes="192x192" href="/android-chrome-192x192.png"><link rel="icon" sizes="512x512" href="/android-chrome-512x512.png"><!-- PWA iOS --><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="apple-touch-startup-image" href="/apple-touch-icon.png"><meta name="apple-mobile-web-app-title" content="Ecolyo"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><!-- PWA Colors --><meta name="theme-color" content="#343641"><meta name="background-color" content="#121212">{{.ThemeCSS}} {{.CozyBar}}<script src="//{{.Domain}}/assets/js/piwik.js"></script></head><body><div role="application" class="application" data-cozy="{{.CozyData}}"><script src="vendors/ecolyo.69beab954af56959f24c.js"></script><script src="app/ecolyo.dcd5fbf6b807f8613a93.js"></script></div></body></html> \ No newline at end of file +<!DOCTYPE html><html lang="{{.Locale}}"><head><meta charset="utf-8"><title>Ecolyo</title><link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"><link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"><!-- PWA Manifest --><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#297EF2"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,viewport-fit=cover"><!-- PWA Chrome --><link rel="icon" sizes="192x192" href="/android-chrome-192x192.png"><link rel="icon" sizes="512x512" href="/android-chrome-512x512.png"><!-- PWA iOS --><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="apple-touch-startup-image" href="/apple-touch-icon.png"><meta name="apple-mobile-web-app-title" content="Ecolyo"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><!-- PWA Colors --><meta name="theme-color" content="#343641"><meta name="background-color" content="#121212">{{.ThemeCSS}} {{.CozyBar}}<script src="//{{.Domain}}/assets/js/piwik.js"></script></head><body><div role="application" class="application" data-cozy="{{.CozyData}}"><script src="vendors/ecolyo.69beab954af56959f24c.js"></script><script src="app/ecolyo.606ae9e3c79d5f7d3766.js"></script></div></body></html> \ No newline at end of file diff --git a/services/aggregatorUsageEvents/ecolyo.js b/services/aggregatorUsageEvents/ecolyo.js index 5be8ec27c93c398a000d469293e754754dba0ef5..730931371aad75c0149c9683a3dea9c4a2d582ea 100644 --- a/services/aggregatorUsageEvents/ecolyo.js +++ b/services/aggregatorUsageEvents/ecolyo.js @@ -96919,7 +96919,7 @@ class ConsumptionDataManager { async getFirsDataDateFromDoctype(doctype) { - const query = (0, _cozyClient.Q)(doctype).where({}).sortBy([{ + const query = (0, _cozyClient.Q)(doctype).where({}).indexFields(['year', 'month']).sortBy([{ year: 'asc' }, { month: 'asc' @@ -96930,8 +96930,11 @@ class ConsumptionDataManager { async getFirstDataDateFromDoctypeWithPrice(doctype) { const query = (0, _cozyClient.Q)(doctype).where({ - price: { - $exists: false + year: { + $gt: null + }, + month: { + $gt: null } }).partialIndex({ price: { @@ -99547,14 +99550,14 @@ class QueryRunner { const doctype = this.getRelevantDoctype(fluidType, timeStep); if (timeStep === _timeStep.TimeStep.HALF_AN_HOUR) { - return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, _timeStep.TimeStep.HALF_AN_HOUR)).indexFields(['load']).limitBy(1).sortBy([{ + return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, _timeStep.TimeStep.HALF_AN_HOUR)).indexFields(['load']).sortBy([{ load: 'desc' - }]); + }]).limitBy(1); } - return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, timeStep)).indexFields(['load']).limitBy(limit).sortBy([{ + return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, timeStep)).indexFields(['load']).sortBy([{ load: 'desc' - }]); + }]).limitBy(limit); } buildFirstDateQuery(fluidType, limit, timeStep) { @@ -99912,7 +99915,7 @@ class QueryRunner { const doctype = this.getRelevantDoctype(fluidType, timeStep); try { - const query = (0, _cozyClient.Q)(doctype).where({}).limitBy(1); + const query = (0, _cozyClient.Q)(doctype).limitBy(1); const result = await this._client.query(query); return result; } catch (error) { @@ -101462,15 +101465,15 @@ class EcogestureService { season: { $ne: seasonFilter } - }).sortBy([{ + }).indexFields(['season']).sortBy([{ season: 'desc' }]); } else if (orderByID) { - query = query.where({}).sortBy([{ + query = query.where({}).indexFields(['_id']).sortBy([{ _id: 'asc' }]); } else { - query = query.where({}).sortBy([{ + query = query.where({}).indexFields(['season']).sortBy([{ season: 'desc' }]); } @@ -101486,7 +101489,7 @@ class EcogestureService { season: { $eq: seasonFilter } - }).sortBy([{ + }).indexFields(['season']).sortBy([{ season: 'asc' }])); return [...ecogesturesWithSeason, ...ecogestures]; @@ -118850,7 +118853,7 @@ class ProfileTypeEntityService { updateDate: { $lte: date.toString() } - }).sortBy([{ + }).indexFields(['updateDate']).sortBy([{ updateDate: 'desc' }]).limitBy(1)); const result = profileType ? profileType : null; @@ -118885,11 +118888,7 @@ class ProfileTypeEntityService { } else { const { data: [profileType] - } = await this._client.query(query.where({ - _id: { - $gt: null - } - }).sortBy([{ + } = await this._client.query(query.where({}).indexFields(['updateDate']).sortBy([{ updateDate: 'desc' }]).limitBy(1)); const result = profileType ? profileType : null; @@ -118918,7 +118917,7 @@ class ProfileTypeEntityService { updateDate: { $gte: timePeriod.startDate.toString() } - }).sortBy([{ + }).indexFields(['updateDate']).sortBy([{ updateDate: 'asc' }]).limitBy(100)); @@ -119070,7 +119069,7 @@ class TermsService { async getLastTerm() { - const query = (0, _cozyClient.Q)(_doctypes.TERMS_DOCTYPE).where({}).sortBy([{ + const query = (0, _cozyClient.Q)(_doctypes.TERMS_DOCTYPE).where({}).indexFields(['acceptedAt']).sortBy([{ acceptedAt: 'desc' }]).limitBy(1); const { @@ -119085,7 +119084,7 @@ class TermsService { async isLastTermValidated() { - const query = (0, _cozyClient.Q)(_doctypes.TERMS_DOCTYPE).where({}).sortBy([{ + const query = (0, _cozyClient.Q)(_doctypes.TERMS_DOCTYPE).where({}).indexFields(['acceptedAt']).sortBy([{ acceptedAt: 'desc' }]).limitBy(1); const { @@ -119242,10 +119241,11 @@ class UsageEventService { try { // Get last Connection attempt Event const query = (0, _cozyClient.Q)(_doctypes.USAGEEVENT_DOCTYPE).where({ + target: konnectorSlug + }).partialIndex({ type: _usageEvent.UsageEventType.KONNECTOR_ATTEMPT_EVENT, - target: konnectorSlug, result: 'error' - }).sortBy([{ + }).indexFields(['eventDate', 'type']).sortBy([{ eventDate: 'desc' }]).limitBy(1); const { diff --git a/services/consumptionAlert/ecolyo.js b/services/consumptionAlert/ecolyo.js index 13fae51ac70e4c6dd377fedf150b0b3bd040d604..619771952111c6298257dc2ae3247ab3d013cad7 100644 --- a/services/consumptionAlert/ecolyo.js +++ b/services/consumptionAlert/ecolyo.js @@ -94610,7 +94610,7 @@ class ConsumptionDataManager { async getFirsDataDateFromDoctype(doctype) { - const query = (0, _cozyClient.Q)(doctype).where({}).sortBy([{ + const query = (0, _cozyClient.Q)(doctype).where({}).indexFields(['year', 'month']).sortBy([{ year: 'asc' }, { month: 'asc' @@ -94621,8 +94621,11 @@ class ConsumptionDataManager { async getFirstDataDateFromDoctypeWithPrice(doctype) { const query = (0, _cozyClient.Q)(doctype).where({ - price: { - $exists: false + year: { + $gt: null + }, + month: { + $gt: null } }).partialIndex({ price: { @@ -97238,14 +97241,14 @@ class QueryRunner { const doctype = this.getRelevantDoctype(fluidType, timeStep); if (timeStep === _timeStep.TimeStep.HALF_AN_HOUR) { - return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, _timeStep.TimeStep.HALF_AN_HOUR)).indexFields(['load']).limitBy(1).sortBy([{ + return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, _timeStep.TimeStep.HALF_AN_HOUR)).indexFields(['load']).sortBy([{ load: 'desc' - }]); + }]).limitBy(1); } - return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, timeStep)).indexFields(['load']).limitBy(limit).sortBy([{ + return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, timeStep)).indexFields(['load']).sortBy([{ load: 'desc' - }]); + }]).limitBy(limit); } buildFirstDateQuery(fluidType, limit, timeStep) { @@ -97603,7 +97606,7 @@ class QueryRunner { const doctype = this.getRelevantDoctype(fluidType, timeStep); try { - const query = (0, _cozyClient.Q)(doctype).where({}).limitBy(1); + const query = (0, _cozyClient.Q)(doctype).limitBy(1); const result = await this._client.query(query); return result; } catch (error) { diff --git a/services/enedisHalfHourMonthlyAnalysis/ecolyo.js b/services/enedisHalfHourMonthlyAnalysis/ecolyo.js index 4c4dab63ee4e5b3fecb5637574e240baa303ca82..009625520eb87b541033b07a2d6977c1491713b2 100644 --- a/services/enedisHalfHourMonthlyAnalysis/ecolyo.js +++ b/services/enedisHalfHourMonthlyAnalysis/ecolyo.js @@ -94610,7 +94610,7 @@ class ConsumptionDataManager { async getFirsDataDateFromDoctype(doctype) { - const query = (0, _cozyClient.Q)(doctype).where({}).sortBy([{ + const query = (0, _cozyClient.Q)(doctype).where({}).indexFields(['year', 'month']).sortBy([{ year: 'asc' }, { month: 'asc' @@ -94621,8 +94621,11 @@ class ConsumptionDataManager { async getFirstDataDateFromDoctypeWithPrice(doctype) { const query = (0, _cozyClient.Q)(doctype).where({ - price: { - $exists: false + year: { + $gt: null + }, + month: { + $gt: null } }).partialIndex({ price: { @@ -97238,14 +97241,14 @@ class QueryRunner { const doctype = this.getRelevantDoctype(fluidType, timeStep); if (timeStep === _timeStep.TimeStep.HALF_AN_HOUR) { - return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, _timeStep.TimeStep.HALF_AN_HOUR)).indexFields(['load']).limitBy(1).sortBy([{ + return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, _timeStep.TimeStep.HALF_AN_HOUR)).indexFields(['load']).sortBy([{ load: 'desc' - }]); + }]).limitBy(1); } - return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, timeStep)).indexFields(['load']).limitBy(limit).sortBy([{ + return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, timeStep)).indexFields(['load']).sortBy([{ load: 'desc' - }]); + }]).limitBy(limit); } buildFirstDateQuery(fluidType, limit, timeStep) { @@ -97603,7 +97606,7 @@ class QueryRunner { const doctype = this.getRelevantDoctype(fluidType, timeStep); try { - const query = (0, _cozyClient.Q)(doctype).where({}).limitBy(1); + const query = (0, _cozyClient.Q)(doctype).limitBy(1); const result = await this._client.query(query); return result; } catch (error) { @@ -98756,7 +98759,7 @@ class EnedisMonthlyAnalysisDataService { async getLastEnedisMonthlyAnalysis() { - const query = (0, _cozyClient.Q)(_doctypes.ENEDIS_MONTHLY_ANALYSIS_DATA_DOCTYPE).where({}).sortBy([{ + const query = (0, _cozyClient.Q)(_doctypes.ENEDIS_MONTHLY_ANALYSIS_DATA_DOCTYPE).where({}).indexFields(['year', 'month']).sortBy([{ year: 'desc' }, { month: 'desc' @@ -98781,7 +98784,7 @@ class EnedisMonthlyAnalysisDataService { const query = (0, _cozyClient.Q)(_doctypes.ENEDIS_MONTHLY_ANALYSIS_DATA_DOCTYPE).where({ year: year, month: month - }).sortBy([{ + }).indexFields(['year', 'month']).sortBy([{ year: 'desc' }, { month: 'desc' @@ -98824,7 +98827,7 @@ class EnedisMonthlyAnalysisDataService { const query = (0, _cozyClient.Q)(_doctypes.ENEDIS_MAXPOWER_DOCTYPE).where({ year: year, month: month - }).sortBy([{ + }).indexFields(['year', 'month']).sortBy([{ year: 'desc' }, { month: 'desc' diff --git a/services/fluidsPrices/ecolyo.js b/services/fluidsPrices/ecolyo.js index f88593fa6862a4394694cdf15e94192bf322413c..04dbd587b088c7343c168a0ae416c7e4ba4271ee 100644 --- a/services/fluidsPrices/ecolyo.js +++ b/services/fluidsPrices/ecolyo.js @@ -94610,7 +94610,7 @@ class ConsumptionDataManager { async getFirsDataDateFromDoctype(doctype) { - const query = (0, _cozyClient.Q)(doctype).where({}).sortBy([{ + const query = (0, _cozyClient.Q)(doctype).where({}).indexFields(['year', 'month']).sortBy([{ year: 'asc' }, { month: 'asc' @@ -94621,8 +94621,11 @@ class ConsumptionDataManager { async getFirstDataDateFromDoctypeWithPrice(doctype) { const query = (0, _cozyClient.Q)(doctype).where({ - price: { - $exists: false + year: { + $gt: null + }, + month: { + $gt: null } }).partialIndex({ price: { @@ -97238,14 +97241,14 @@ class QueryRunner { const doctype = this.getRelevantDoctype(fluidType, timeStep); if (timeStep === _timeStep.TimeStep.HALF_AN_HOUR) { - return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, _timeStep.TimeStep.HALF_AN_HOUR)).indexFields(['load']).limitBy(1).sortBy([{ + return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, _timeStep.TimeStep.HALF_AN_HOUR)).indexFields(['load']).sortBy([{ load: 'desc' - }]); + }]).limitBy(1); } - return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, timeStep)).indexFields(['load']).limitBy(limit).sortBy([{ + return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, timeStep)).indexFields(['load']).sortBy([{ load: 'desc' - }]); + }]).limitBy(limit); } buildFirstDateQuery(fluidType, limit, timeStep) { @@ -97603,7 +97606,7 @@ class QueryRunner { const doctype = this.getRelevantDoctype(fluidType, timeStep); try { - const query = (0, _cozyClient.Q)(doctype).where({}).limitBy(1); + const query = (0, _cozyClient.Q)(doctype).limitBy(1); const result = await this._client.query(query); return result; } catch (error) { @@ -98872,14 +98875,14 @@ class FluidPricesService { async getPrices(fluidType, date) { - const query = (0, _cozyClient.Q)(_doctypes.FLUIDSPRICES_DOCTYPE).indexFields(['startDate']).where({ + const query = (0, _cozyClient.Q)(_doctypes.FLUIDSPRICES_DOCTYPE).where({ startDate: { $lte: date.toISO({ suppressMilliseconds: true }).toString() }, fluidType - }).sortBy([{ + }).indexFields(['startDate']).sortBy([{ startDate: 'desc' }]).limitBy(1); const { @@ -98894,11 +98897,11 @@ class FluidPricesService { async getAllLastPrices() { - const query = (0, _cozyClient.Q)(_doctypes.FLUIDSPRICES_DOCTYPE).indexFields(['fluidType']).where({ + const query = (0, _cozyClient.Q)(_doctypes.FLUIDSPRICES_DOCTYPE).where({ endDate: { $eq: '' } - }).sortBy([{ + }).indexFields(['fluidType']).sortBy([{ fluidType: 'asc' }]).limitBy(3); const { diff --git a/services/monthlyReportNotification/ecolyo.js b/services/monthlyReportNotification/ecolyo.js index 5a19a3e04334b77ab9f64a626111f483f4b23a19..bdb4f53b94af452f837c360625629100c9757b07 100644 --- a/services/monthlyReportNotification/ecolyo.js +++ b/services/monthlyReportNotification/ecolyo.js @@ -94610,7 +94610,7 @@ class ConsumptionDataManager { async getFirsDataDateFromDoctype(doctype) { - const query = (0, _cozyClient.Q)(doctype).where({}).sortBy([{ + const query = (0, _cozyClient.Q)(doctype).where({}).indexFields(['year', 'month']).sortBy([{ year: 'asc' }, { month: 'asc' @@ -94621,8 +94621,11 @@ class ConsumptionDataManager { async getFirstDataDateFromDoctypeWithPrice(doctype) { const query = (0, _cozyClient.Q)(doctype).where({ - price: { - $exists: false + year: { + $gt: null + }, + month: { + $gt: null } }).partialIndex({ price: { @@ -97238,14 +97241,14 @@ class QueryRunner { const doctype = this.getRelevantDoctype(fluidType, timeStep); if (timeStep === _timeStep.TimeStep.HALF_AN_HOUR) { - return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, _timeStep.TimeStep.HALF_AN_HOUR)).indexFields(['load']).limitBy(1).sortBy([{ + return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, _timeStep.TimeStep.HALF_AN_HOUR)).indexFields(['load']).sortBy([{ load: 'desc' - }]); + }]).limitBy(1); } - return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, timeStep)).indexFields(['load']).limitBy(limit).sortBy([{ + return (0, _cozyClient.Q)(doctype).where(this.getPredicate(maxTimePeriod, timeStep)).indexFields(['load']).sortBy([{ load: 'desc' - }]); + }]).limitBy(limit); } buildFirstDateQuery(fluidType, limit, timeStep) { @@ -97603,7 +97606,7 @@ class QueryRunner { const doctype = this.getRelevantDoctype(fluidType, timeStep); try { - const query = (0, _cozyClient.Q)(doctype).where({}).limitBy(1); + const query = (0, _cozyClient.Q)(doctype).limitBy(1); const result = await this._client.query(query); return result; } catch (error) {