Exercise Tracker Log Tests

Tell us what’s happening:
Code appears to work, but isn’t passing all the log tests. Without knowing what the tests are looking for specifically, i’m having trouble diagnosing the issue.

Your project link(s)
boilerplate-project-exercisetracker - Replit

Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36

Challenge: Exercise Tracker
Link to the challenge:

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

When I request a specific users exercise logs this route is returning all the exercises in the database. And I found you are finding the exercises using Exercise.find({idToCheck}). Make sure it’s correct.

The easy way to know this is to look at the specs on the submission page and then log the route inputs and output for each route so you can see what information is being provided by the tests and then compare your route responses to the specs.

The second way is to look at the source for the tests in the curriculum repo on github. It’s the same information as above, but in a different format.

@jeremy.a.gray I’m not really sure how to do either of those.

@adramelech Thanks! The problem ended up being that I was logging the exercises without an associated username, but Mongoose automatically generates an id for each entry. So of course when I tried to search through the exercises by user Id, it didn’t find anything.

New Problem
All tests pass except for:
" The date property of any object in the log array that is returned from GET /api/users/:id/logs should be a string… Use the dateString format of the Date API."

Project link is still the same, though it’s been updated. Everywhere I write about a date it’s using the toDateString method.

First one: the output specs are where you submit your link for testing. The input you can get (since you are writing the API) by adding

  console.log(`req.body: ${JSON.stringify(req.body)}`);
  console.log(`req.params: ${JSON.stringify(req.params)}`);
  console.log(`req.query: ${JSON.stringify(req.query)}`);

at the top of the route of interest and

console.log(my_json_response);

right before

return res.json(my_json_response);

and the format should match the given specs, with the correct information.

For the second, google on over to the fCC github website and look through the curriculum repo.

Search the forums for the timezone offset issue and see if it’s that.

All tests passed, thanks everyone!