From 6a1c18823ed8fc4c280cdc35af5e7d47920d421f Mon Sep 17 00:00:00 2001 From: Damien Drozd Date: Wed, 6 Dec 2023 11:23:14 +0100 Subject: [PATCH 1/2] fix(frontend): fix algo --- src/controllers/match.controller.js | 41 +++++++++++++---------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/controllers/match.controller.js b/src/controllers/match.controller.js index 4b25eab..310f92a 100644 --- a/src/controllers/match.controller.js +++ b/src/controllers/match.controller.js @@ -30,14 +30,11 @@ exports.getSwipeProfil = async (req, res, next) => { * @access Private */ exports.getCompatibleProfil = async (req, res, next) => { - console.log("test") try { const filters = req.body User.findById(req.userToken.id) .then(user => { - - const userPreferences = user.preferences; const minBirth = moment(date).subtract(userPreferences.age.min, 'years'); const maxBirth = moment(date).subtract(userPreferences.age.max, 'years'); @@ -94,27 +91,27 @@ exports.getCompatibleProfil = async (req, res, next) => { _id: { $nin: likeTab }, - birthday: { - $gt: maxBirth, - $lt: minBirth, - $exists: true - }, + // birthday: { + // $gt: maxBirth, + // $lt: minBirth, + // $exists: true + // }, // "preferences.age.min": { // $lt: age, - // $exists: true + // $exists: true // }, // "preferences.age.max": { // $gt: age, - // $exists: true + // $exists: true + // }, + // gender: { + // $in: sexeTab, + // $exists: true + // }, + // "preferences.sexual_orientation": { + // $in: orientationTab, + // $exists: true // }, - gender: { - $in: sexeTab, - $exists: true - }, - "preferences.sexual_orientation": { - $in: orientationTab, - $exists: true - }, "firstName": { $exists: true }, @@ -124,15 +121,15 @@ exports.getCompatibleProfil = async (req, res, next) => { "gif.image.url": { $exists: true }, - "movie.image.poster_path": { + "movie.images.poster_path": { $exists: true }, "movie.title": { $exists: true }, - // "music.image.url": { - // $exists: true - // }, + "music.image": { + $exists: true + }, "questions": { $exists: true }, From af788e419faec039fce4c322e3fbea84d19da73c Mon Sep 17 00:00:00 2001 From: Damien Drozd Date: Wed, 6 Dec 2023 12:58:54 +0100 Subject: [PATCH 2/2] fix(frontend): fix algo profiles modules --- src/controllers/match.controller.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/controllers/match.controller.js b/src/controllers/match.controller.js index 310f92a..96651d4 100644 --- a/src/controllers/match.controller.js +++ b/src/controllers/match.controller.js @@ -139,10 +139,13 @@ exports.getCompatibleProfil = async (req, res, next) => { }, "biographie": { $exists: true + }, + "profileModules": { + $exists: true } }, [ - "firstName", "lastName", "gender", "gif", "movie", "music", "music", "questions", "interests", "biographie", "isFake" + "firstName", "lastName", "gender", "gif", "movie", "music", "music", "questions", "interests", "biographie", "isFake", "profileModules" ] ) .then(profiles => {