Exercise FreeCodeCamp Project is not finishing for me

Tell us what’s happening:
i was trying to do the exercise tracker challenge
and i have followed the requirements, but there are 2 tests that is not correct.

  1. The response returned from POST /api/users/:_id/exercises will be the user object with the exercise fields added.
  2. You can add from , to and limit parameters to a GET /api/users/:_id/logs request to retrieve part of the log of any user. from and to are dates in yyyy-mm-dd format. limit is an integer of how many logs to send back.

Your project link(s)

solution: index.js - boilerplate-project-exercisetracker-1 - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.33

Challenge: Exercise Tracker

Link to the challenge:

I added some logging. On the log route, here’s the last (failing) test:

ID : 62a27661d10be95b496857eb 
BODY : {"description":"test","duration":"60","date":"1990-01-01"}
DESCRIPTION : test
DURATION : 60
DATE : 1990-01-01

ID : 62a27661d10be95b496857eb 
BODY : {"description":"test","duration":"60","date":"1990-01-03"}
DESCRIPTION : test
DURATION : 60
DATE : 1990-01-03

req.body: {}
req.params: {"id":"62a27661d10be95b496857eb"}
req.query: {"from":"1989-12-31","to":"1990-01-04"}
USERDATA : {
  _id: new ObjectId("62a27661d10be95b496857eb"),
  username: 'fcc_test_16548143052',
  __v: 0
}
{
  username: 'fcc_test_16548143052',
  count: 0,
  _id: new ObjectId("62a27661d10be95b496857eb"),
  log: []
}

The problem appears to be with the limit since it is not passed in it is undefined.

Likewise logging the inputs and outputs on the POST exercise route:

req.body: {"description":"test","duration":"60","date":"1990-01-03"}
req.params: {"id":"62a277dd669dc58c9d4f7245"}
req.query: {}
ID : 62a277dd669dc58c9d4f7245 
BODY : {"description":"test","duration":"60","date":"1990-01-03"}
DESCRIPTION : test
DURATION : 60
DATE : 1990-01-03

{
  username: 'fcc_test_16548146853',
  description: 'test',
  duration: 60,
  date: 'Thu Jun 09 2022',
  _id: new ObjectId("62a277dd669dc58c9d4f7245")
}

The date is incorrect in the returned object.

i recoded the exercise tracker, on replit, and the last 2 test was still not finishing, so i use code sandbox and now it worked, thank you

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