Skip to content

Commit

Permalink
Sosynpl[premieroctet#120]: removed freelance profile completion filte…
Browse files Browse the repository at this point in the history
…r, added required attributes
  • Loading branch information
SeghirOumo committed Aug 6, 2024
1 parent a288e23 commit 4c87124
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backend/web/server/plugins/sosynpl/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { NATIONALITIES, PURCHASE_STATUS, LANGUAGE_LEVEL, REGIONS } = require("../
const {computeUserHardSkillsCategories, computeHSCategoryProgress } = require("./hard_skills");
const SoftSkill = require("../../models/SoftSkill");
const { computeAvailableGoldSoftSkills, computeAvailableSilverSoftSkills,computeAvailableBronzeSoftSkills } = require("./soft_skills");
const { computeSuggestedFreelances, searchFreelances, countFreelances, searchAnnounces, countAnnounce } = require("./search");
const { computeSuggestedFreelances, searchFreelances, countFreelances, searchAnnounces, countAnnounce, FREELANCE_SUGGESTION_REQUIRES } = require("./search");
const AnnounceSugggestion=require('../../models/AnnounceSuggestion')
const cron = require('../../utils/cron')
const moment = require('moment');
Expand Down Expand Up @@ -294,7 +294,7 @@ declareEnumField({model: 'softSkill', field: 'value', enumValues: SOFT_SKILLS})

/** Announce start */
declareVirtualField({model: 'announce', field: 'total_budget', instance: 'Number', requires: 'budget'})
declareComputedField({model: 'announce', field: 'suggested_freelances', getterFn: computeSuggestedFreelances})
declareComputedField({model: 'announce', field: 'suggested_freelances', requires: [...FREELANCE_SUGGESTION_REQUIRES].join(','), getterFn: computeSuggestedFreelances})
declareEnumField({model: 'announce', field: 'duration_unit', enumValues: DURATION_UNIT})
declareEnumField({model: 'announce', field: 'mobility', enumValues: ANNOUNCE_MOBILITY})
declareEnumField({model: 'announce', field: 'soft_skills', enumValues: SS_PILAR})
Expand Down
15 changes: 13 additions & 2 deletions backend/web/server/plugins/sosynpl/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ const Announce = require('../../models/Announce')
const { REGIONS_FULL } = require('../../../utils/consts')
const { loadFromDb } = require('../../utils/database')

const FREELANCE_SUGGESTION_REQUIRES = [
'job',
'sectors',
'expertises',
'softwares',
'languages',
'experience',
'homework_days',
'duration',
'mobility'
]

const computeSuggestedFreelances = async (userId, params, data) => {
const getRegionFromZipcode = (zipcode) => {
const departmentCode = String(zipcode).substring(0, 2)
Expand Down Expand Up @@ -53,8 +65,6 @@ const computeSuggestedFreelances = async (userId, params, data) => {
.populate('experiences')
.populate('trainings')

freelances = freelances.filter(freelance => freelance.freelance_profile_completion === 1)

freelances.forEach((freelance) => {
let score = 0
let regionKey
Expand Down Expand Up @@ -267,4 +277,5 @@ const countAnnounce = async (userId, params, data, fields) => {

module.exports={
computeSuggestedFreelances, searchFreelances, countFreelances, searchAnnounces, countAnnounce,
FREELANCE_SUGGESTION_REQUIRES
}

0 comments on commit 4c87124

Please sign in to comment.