From d4a908de8cc69d11335829658936db024f8af4c6 Mon Sep 17 00:00:00 2001 From: Damien Drozd <79458391+DamienDrozd@users.noreply.github.com> Date: Wed, 6 Dec 2023 11:32:11 +0100 Subject: [PATCH] fix(frontend): fix algo (#40) --- 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 },