Exercise Tracker Challenge Test 4

Hello,

I can’t get test number four to pass.

It works for me locally but it doesn’t pass test number 4.

I know the question is very wide open but frankly if it works locally then the answer probably has something to do with what the “test” is. Which aren’t public.

Hello there,

The tests are public here: freeCodeCamp/exercise-tracker.md at main · freeCodeCamp/freeCodeCamp · GitHub

Otherwise, the first thing that jumps out is the way you are getting the id: fccExerciseTrackerChallenge/usersApi.js at main · kbventures/fccExerciseTrackerChallenge · GitHub

I can see you have it commented out, but it is clear from the endpoint the id should come from the params.

Also, I could be mistaken, but wouldn’t exercise.duration be a string here?; fccExerciseTrackerChallenge/usersApi.js at 2b4e158890b3356d4b507388308dfedc4611facf · kbventures/fccExerciseTrackerChallenge · GitHub

Hope this helps

1 Like

Ok. It works.

Wow. So many hours. LOL

So without having research the test you sent me already.(again thank you).

I will.

It seems that the test is checking wether I am using req.params vs req.body and not a work around(bad practice which I used due to lack of understanding).

Thanks a lot! :slight_smile:

Glad you got it working. Well done.

The test is following the spec:

You can make a GET request to /api/users/:_id/logs to retrieve a full exercise log of any user.

So, it is not checking whether or not you are using req.params, but it is passing the _id through the route string. Much the same way this forum does it (passing the topic id as a param).

Hope this clarifies

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.