diff --git a/index.js b/index.js index 248cf7b96b156c9db3f953b7a9f5fe0990687122..8c18b080db1be2f87f1b8996bd60b5a6a8a43749 100644 --- a/index.js +++ b/index.js @@ -183542,10 +183542,14 @@ const FAKE_TRANSACTION = { manualCategoryId: '0' }; const TOKENS_TO_REWEIGHT = ['tag_neg', 'tag_v_b_expense', 'tag_neg tag_v_b_expense', 'tag_b_expense', 'tag_neg tag_b_expense', 'tag_expense', 'tag_neg tag_expense', 'tag_noise_neg', 'tag_neg tag_noise_neg', 'tag_pos', 'tag_noise_pos', 'tag_pos tag_noise_pos', 'tag_income', 'tag_pos tag_income', 'tag_b_income', 'tag_pos tag_b_income', 'tag_activity_income', 'tag_pos tag_activity_income']; +/** + * Get the classifier options, mainly to get the alpha parameter + * + * @param {number} nbUniqueCategories - Number of unique categories + * @returns {object} the classifier options + */ -const getClassifierOptions = transactionsWithManualCat => { - const uniqueCategories = getUniqueCategories(transactionsWithManualCat); - const nbUniqueCategories = uniqueCategories.length; +const getClassifierOptions = nbUniqueCategories => { log('debug', 'Number of unique categories in transactions with manual categories: ' + nbUniqueCategories); const alpha = getAlphaParameter(nbUniqueCategories, ALPHA_MIN, ALPHA_MAX, ALPHA_MAX_SMOOTHING); log('debug', 'Alpha parameter value is ' + alpha); @@ -183656,7 +183660,8 @@ const createClassifier = async options => { log('debug', `Fetched ${transactions.length} transactions`); log('debug', 'Instanciating a new classifier'); - const classifierOptions = getClassifierOptions(transactions); + const uniqueCategories = getUniqueCategories(transactions); + const classifierOptions = getClassifierOptions(uniqueCategories?.length || 0); const classifier = createLocalClassifier(transactions, { ...remainingOptions, ...classifierOptions.initialization }, classifierOptions.configuration); @@ -240367,7 +240372,7 @@ var SpanStatus; (function (SpanStatus) { /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"egl","version":"1.2.0","description":"","repository":{"type":"git","url":"git+https://forge.grandlyon.com/web-et-numerique/llle_project/egl-konnector.git"},"keywords":[],"author":"Grand Lyon","license":"AGPL-3.0","main":"./src/index.js","eslintConfig":{"extends":["cozy-app"]},"eslintIgnore":["build"],"husky":{"hooks":{"pre-commit":"yarn lint"}},"scripts":{"start":"node ./src/index.js","dev":"cozy-konnector-dev","standalone":"cozy-konnector-standalone","pretest":"npm run clean","test":"konitor testit .","check":"konitor check .","clean":"rm -rf ./data","build":"webpack","lint":"eslint --fix .","deploy":"git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build}","deploy-dev":"git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build-dev}","cozyPublish":"cozy-app-publish --token $REGISTRY_TOKEN --build-commit $(git rev-parse ${DEPLOY_BRANCH:-build})","travisDeployKey":"./bin/generate_travis_deploy_key"},"dependencies":{"@sentry/node":"7.30.0","@sentry/tracing":"7.30.0","cozy-konnector-libs":"5.1.0","moment":"^2.24.0","moment-timezone":"^0.5.26","axios":"1.2.2"},"devDependencies":{"@types/moment-timezone":"^0.5.30","copy-webpack-plugin":"6.1.1","cozy-app-publish":"0.25.0","cozy-jobs-cli":"2.0.1","cozy-konnector-build":"1.4.4","eslint":"5.16.0","eslint-config-cozy-app":"1.6.0","eslint-plugin-prettier":"3.0.1","git-directory-deploy":"1.5.1","husky":"4.3.0","konitor":"0.10.2","standard-version":"^9.5.0","svgo":"1.3.2","webpack":"5.75.0","webpack-cli":"5.0.1"}}'); +module.exports = JSON.parse('{"name":"egl","version":"1.2.0","description":"","repository":{"type":"git","url":"git+https://forge.grandlyon.com/web-et-numerique/llle_project/egl-konnector.git"},"keywords":[],"author":"Grand Lyon","license":"AGPL-3.0","main":"./src/index.js","eslintConfig":{"extends":["cozy-app"]},"eslintIgnore":["build"],"husky":{"hooks":{"pre-commit":"yarn lint"}},"scripts":{"start":"node ./src/index.js","dev":"cozy-konnector-dev","standalone":"cozy-konnector-standalone","pretest":"npm run clean","test":"konitor testit .","check":"konitor check .","clean":"rm -rf ./data","build":"webpack","lint":"eslint --fix .","deploy":"git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build}","deploy-dev":"git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build-dev}","cozyPublish":"cozy-app-publish --token $REGISTRY_TOKEN --build-commit $(git rev-parse ${DEPLOY_BRANCH:-build})","travisDeployKey":"./bin/generate_travis_deploy_key"},"dependencies":{"@sentry/node":"7.30.0","@sentry/tracing":"7.30.0","cozy-konnector-libs":"5.2.0","moment":"^2.24.0","moment-timezone":"^0.5.26","axios":"1.2.2"},"devDependencies":{"@types/moment-timezone":"^0.5.30","copy-webpack-plugin":"6.1.1","cozy-app-publish":"0.25.0","cozy-jobs-cli":"2.0.2","cozy-konnector-build":"1.4.4","eslint":"5.16.0","eslint-config-cozy-app":"1.6.0","eslint-plugin-prettier":"3.0.1","git-directory-deploy":"1.5.1","husky":"4.3.0","konitor":"0.10.2","standard-version":"^9.5.0","svgo":"1.3.2","webpack":"5.75.0","webpack-cli":"5.0.1"}}'); /***/ }), /* 1647 */ diff --git a/package.json b/package.json index 621d69fcd76a2d667a762456ccc91e22a86c1803..3c1eb4452ad70495fdd125331d13aae8b590c520 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "dependencies": { "@sentry/node": "7.30.0", "@sentry/tracing": "7.30.0", - "cozy-konnector-libs": "5.1.0", + "cozy-konnector-libs": "5.2.0", "moment": "^2.24.0", "moment-timezone": "^0.5.26", "axios": "1.2.2" @@ -50,7 +50,7 @@ "@types/moment-timezone": "^0.5.30", "copy-webpack-plugin": "6.1.1", "cozy-app-publish": "0.25.0", - "cozy-jobs-cli": "2.0.1", + "cozy-jobs-cli": "2.0.2", "cozy-konnector-build": "1.4.4", "eslint": "5.16.0", "eslint-config-cozy-app": "1.6.0",