ExerciseTracker Project - test failing dont know why

Don’t know what is happening, test 11, 14, and 15 keep failing.
My solution and the sample solution look just the same.

While looking for solutions I notice that a lot of people have this kind of problem with this challenge, I must be doing something wrong, probably something very dumb but I just can’t figure it out. Please somebody help me :sob:

Your project link(s)

solution: https://replit.com/@leonardom6/exercisetracker
replit link: https://replit.com/@LeonardoM6/ExerciseTracker

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0

Challenge: Exercise Tracker

Link to the challenge:

For challenge 11, it looks like you’re returning all logs - not the logs of a specific user.

A GET request to /api/users/:id/logs will return the **user object **with a log array of all the exercises added.

It should return the user object. Part of that user object should be an array with property user.log that contains all of the excercise objects added to the user.

Here’s what I got when I checked the user I just made:

{"_id":"620ad4bfa651bd87261f9646","username":"fcc_test_16448769902","count":45,"log":[{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Tue Jan 02 1990"},{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Tue Jan 02 1990"},{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Tue Jan 02 1990"},{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Feb 14 2022"},{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Tue Jan 02 1990"},{"description":"test excercise","duration":10,"date":"Tue Dec 20 2022"}]}

If you fixed that, the other challenges should pass :smiley:

1 Like

Thank you very much, You were a savior, really.
I went to test what you just comment and end up that i was never creating another user past the first one. Because I was using


> let findUser = await USER.findOne({
      'users.username': uname
    });
    if (findUser) { ...

that users.username don’t exist, it should be just username
uname is the input data.
And it was falling in the " user already exist if statement" every time.

With that fixed everything work out just fine. Thank you very much, I was having trouble with this challenge for a couple of days now. :star_struck: