Exercise Tracker test - not able to pass three tests

Tell us what’s happening:
Describe your issue in detail here.
Hi FCC forum folks!

I’ve been working through the tasks on the Exercise tracker, but can’t seem to pass three tests that are correlated to each other, I’m struggling to understand what the tests are looking for, the tests are related to the 3 logs endpoint tasks which are listed below.

A request to a user’s log GET /api/users/:_id/logs returns a user object with a count property representing the number of exercises that belong to that user.

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

Each item in the log array that is returned from GET /api/users/:id/logs is an object that should have a description , duration , and date properties.

It shows as incorrect, however when I test it myself I get the following output, which seems correct to me, am I doing something wrong or is the test looking for something in particular?

[{"_id":"61b755b9a6229112655fa5af","username":"bruh","count":3,"log":[{"description":"test","duration":20,"date":"Mon Dec 13 2021","_id":"61b755eaa6229112655fa5b2"},{"description":"run","duration":20,"date":"Mon Dec 13 2021","_id":"61b75644a6229112655fa5b8"},{"description":"walk","duration":15,"date":"Mon Dec 13 2021","_id":"61b75649a6229112655fa5bd"}],"__v":0}]

This is my response json from testing the logs endpoint with a user.

Your project link(s)

solution: https://replit.com/@hevxr/boilerplate-project-exercisetracker-2

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36

Challenge: Exercise Tracker

Link to the challenge:

Bumping this as I’m hoping that someone knows how to get past some of these tests

You’ve got several problems. First, you’re getting all kinds of errors on the console from mongoose about queries getting done out of order because you’ve mixed await and callback syntax in several places. Once you fix that, log your route inputs and outputs and you’ll see stuff like

req.body: {}
req.params: {"_id":"61ce557bbb09d5f4d28c65e5"}
req.query: {}
    _id: new ObjectId("61ce557bbb09d5f4d28c65e5"),
    username: 'fcc_test_16409122516',
    count: 1,
    log: [ [Object] ],
    __v: 0

which has problems since you’re returning an array of objects instead of an object with an array inside and the log array is not showing the correct fields (although it may stringify the object before transmission anyway). Finally, there’s a timezone offset problem that you can’t fix (because the project uses dates and not timestamps) so to pass that test just run the project when your local date and UTC date are equal.

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