From d571ba6e66e2f5b2cc7dc4f25ebdf3d354ad4261 Mon Sep 17 00:00:00 2001 From: Bastien DUMONT <bdumont@grandlyon.com> Date: Fri, 2 Dec 2022 15:57:56 +0100 Subject: [PATCH] publish: fix typos generated from commit 52f51df5f15e1e4246b83df4b47970fc89b1b9d6 --- index.js | 56 ++++++++++++++++++++++++---------------------- onDeleteAccount.js | 9 ++++---- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/index.js b/index.js index 3e17c2b..c91f5bd 100644 --- a/index.js +++ b/index.js @@ -15,7 +15,7 @@ const soapRequest = __webpack_require__(1337) const moment = __webpack_require__(1379) __webpack_require__(1516) const xml2js = __webpack_require__(1519) -const { buildAgregatedData } = __webpack_require__(1560) +const { buildAggregatedData } = __webpack_require__(1560) const { parseSgeXmlData, formateDataForDoctype, @@ -152,14 +152,14 @@ async function start(fields, cozyParameters) { ) // handle user contract start date in order to properly request data - const userContractstartDate = await getContractStartDate( + const userContractStartDate = await getContractStartDate( baseUrl, apiAuthKey, sgeLogin, pointId ) - startDailyDate = moment(userContractstartDate, 'YYYY-MM-DD') + startDailyDate = moment(userContractStartDate, 'YYYY-MM-DD') startDailyDateString = startDailyDate.format('YYYY-MM-DD') const contractStartDate = moment().format('YYYY-MM-DD') @@ -309,14 +309,14 @@ async function deleteConsent( */ async function gatherData(baseUrl, apiAuthKey, sgeLogin, pointId) { log('info', 'Querying data...') - const userContractstartDate = await getContractStartDate( + const userContractStartDate = await getContractStartDate( baseUrl, apiAuthKey, sgeLogin, pointId ) - startDailyDate = moment(userContractstartDate, 'YYYY-MM-DD') + startDailyDate = moment(userContractStartDate, 'YYYY-MM-DD') startDailyDateString = startDailyDate.format('YYYY-MM-DD') await getData( @@ -467,7 +467,7 @@ async function getDataHalfHour(url, apiAuthKey, userLogin, pointId) { for (var i = 0; i < MAX_HISTO; i++) { log('info', 'launch process with history') - const increamentedStartDateString = moment(startLoadDate) + const incrementedStartDateString = moment(startLoadDate) .subtract(7 * i, 'day') .format('YYYY-MM-DD') const incrementedEndDateString = moment(endDate) @@ -480,7 +480,7 @@ async function getDataHalfHour(url, apiAuthKey, userLogin, pointId) { xml: consultationMesuresDetaillees( pointId, userLogin, - increamentedStartDateString, + incrementedStartDateString, incrementedEndDateString, 'COURBE', 'PA' @@ -529,7 +529,7 @@ function processData(doctype = 'com.grandlyon.enedis.day') { log('info', 'Aggregate enedis daily data for month and year') if (doctype === 'com.grandlyon.enedis.day') { log('info', 'Aggregating...') - await agregateMonthAndYearData(processedDailyData) + await aggregateMonthAndYearData(processedDailyData) } } catch (e) { if (doctype === 'com.grandlyon.enedis.minute') { @@ -563,7 +563,7 @@ async function storeData(data, doctype, filterKeys) { /** * Aggregate data from daily data to monthly and yearly data */ -async function agregateMonthAndYearData(data) { +async function aggregateMonthAndYearData(data) { // Sum year and month values into object with year or year-month as keys if (data && data.length > 0) { let monthData = {} @@ -576,21 +576,21 @@ async function agregateMonthAndYearData(data) { ? (yearData[element.year] += element.load) : (yearData[element.year] = element.load) }) - // Agregation for Month data - const agregatedMonthData = await buildAgregatedData( + // Aggregation for Month data + const aggregatedMonthData = await buildAggregatedData( monthData, 'com.grandlyon.enedis.month' ) - await storeData(agregatedMonthData, 'com.grandlyon.enedis.month', [ + await storeData(aggregatedMonthData, 'com.grandlyon.enedis.month', [ 'year', 'month', ]) - // Agregation for Year data - const agregatedYearData = await buildAgregatedData( + // Aggregation for Year data + const aggregatedYearData = await buildAggregatedData( yearData, 'com.grandlyon.enedis.year' ) - await storeData(agregatedYearData, 'com.grandlyon.enedis.year', ['year']) + await storeData(aggregatedYearData, 'com.grandlyon.enedis.year', ['year']) } } @@ -223567,18 +223567,18 @@ const { log, cozyClient } = __webpack_require__(1) /** * Retrieve and remove old data for a specific doctype - * Return an Array of agregated data + * Return an Array of aggregated data */ -async function buildAgregatedData(data, doctype) { - let agregatedData = [] +async function buildAggregatedData(data, doctype) { + let aggregatedData = [] // eslint-disable-next-line no-unused-vars for (let [key, value] of Object.entries(data)) { const data = buildDataFromKey(doctype, key, value) const oldValue = await resetInProgressAggregatedData(data, doctype) data.load += oldValue - agregatedData.push(data) + aggregatedData.push(data) } - return agregatedData + return aggregatedData } /** @@ -223666,7 +223666,7 @@ async function resetInProgressAggregatedData(data, doctype) { } module.exports = { - buildAgregatedData, + buildAggregatedData, } @@ -223843,7 +223843,7 @@ function removeMultipleSpaces(str) { * @param {string} str * @returns {string} */ -function removeAddressnumber(str) { +function removeAddressNumber(str) { return str.replace(/\d+ |b |B |T |t |\d+/g, '') } @@ -223859,7 +223859,7 @@ module.exports = { parseUserPdl, parseValue, parseValueHalfHour, - removeAddressnumber, + removeAddressNumber, removeMultipleSpaces, } @@ -241946,7 +241946,7 @@ const { getInseeCode } = __webpack_require__(1689) const { findUserAddress } = __webpack_require__(1690) const { removeMultipleSpaces, - removeAddressnumber, + removeAddressNumber, } = __webpack_require__(1561) const Sentry = __webpack_require__(1601) @@ -242022,7 +242022,7 @@ async function verifyUserIdentity( apiAuthKey, loginUtilisateur, fields.lastname, - removeMultipleSpaces(removeAddressnumber(userAddress.numeroEtNomVoie)), + removeMultipleSpaces(removeAddressNumber(userAddress.numeroEtNomVoie)), userAddress.codePostal, userAddress.commune.$.code ) @@ -242035,7 +242035,7 @@ async function verifyUserIdentity( apiAuthKey, loginUtilisateur, fields.lastname, - removeMultipleSpaces(removeAddressnumber(userAddress.numeroEtNomVoie)), + removeMultipleSpaces(removeAddressNumber(userAddress.numeroEtNomVoie)), userAddress.codePostal, userAddress.commune.$.code, escalierEtEtageEtAppartement @@ -242152,7 +242152,9 @@ async function findUserAddress(url, apiAuthKey, userLogin, pointId) { headers: sgeHeaders, xml: consulterDonneesTechniquesContractuelles(pointId, userLogin, false), }).catch(err => { - log('error', 'Error while fetching user : ' + err) + const errorMessage = 'Error while fetching user : ' + err + log('error', errorMessage) + Sentry.captureException(errorMessage) throw errors.VENDOR_DOWN }) diff --git a/onDeleteAccount.js b/onDeleteAccount.js index bcb293d..db1538b 100644 --- a/onDeleteAccount.js +++ b/onDeleteAccount.js @@ -223125,7 +223125,7 @@ function removeMultipleSpaces(str) { * @param {string} str * @returns {string} */ -function removeAddressnumber(str) { +function removeAddressNumber(str) { return str.replace(/\d+ |b |B |T |t |\d+/g, '') } @@ -223141,7 +223141,7 @@ module.exports = { parseUserPdl, parseValue, parseValueHalfHour, - removeAddressnumber, + removeAddressNumber, removeMultipleSpaces, } @@ -240975,11 +240975,12 @@ const { terminateContract } = __webpack_require__(1684) const { getAccountForDelete } = __webpack_require__(1691) const moment = __webpack_require__(1379) __webpack_require__(1516) -moment.locale('fr') // set the language -moment.tz.setDefault('Europe/Paris') // set the timezone const { isLocal, isDev } = __webpack_require__(1692) const Sentry = __webpack_require__(1601) +moment.locale('fr') // set the language +moment.tz.setDefault('Europe/Paris') // set the timezone + async function onDeleteAccount() { log('info', 'Deleting account ...') log('info', 'Getting secrets ...') -- GitLab