From c1b975ebf7b40018d7fdd1c9e744bb50f4405730 Mon Sep 17 00:00:00 2001 From: Bastien Seree Date: Thu, 26 Sep 2024 17:18:27 +0200 Subject: [PATCH] Cyberleague: [#121] add ensureMarketScore function --- backend/web/server/plugins/cyberleague/functions.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/web/server/plugins/cyberleague/functions.js b/backend/web/server/plugins/cyberleague/functions.js index f69d953c63..17ac85abf8 100644 --- a/backend/web/server/plugins/cyberleague/functions.js +++ b/backend/web/server/plugins/cyberleague/functions.js @@ -24,7 +24,7 @@ const QuestionCategory = require('../../models/QuestionCategory') const { isMineForMessage } = require('./message') const { getConversationPartner } = require('./conversation') const ExpertiseCategory = require('../../models/ExpertiseCategory') -const { getQuestionsByCategory, computeScoresIfRequired, getCategoryRates } = require('./score') +const { getQuestionsByCategory, computeScoresIfRequired, getCategoryRates, updateMarketScore } = require('./score') const Conversation = require('../../models/Conversation') const Score = require('../../models/Score') const Gain = require('../../models/Gain') @@ -346,6 +346,13 @@ const ensureGains = () => { ensureGains() +//create score with market values +const ensureMarketScore = async () => { + const _category_rates = null + await updateMarketScore(_category_rates) +} + +ensureMarketScore() const preprocessGet = async ({model, fields, id, user, params}) => { if (model=='loggedUser') {