Skip to content

Commit

Permalink
fix(frontend): fix algo (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienDrozd committed Dec 6, 2023
1 parent 11a95c8 commit d4a908d
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions src/controllers/match.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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
},
Expand All @@ -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
},
Expand Down

0 comments on commit d4a908d

Please sign in to comment.