Back End Development and APIs Projects - Exercise Tracker

Can somebody tell me why i can’t pass the last test even though my program outputs the expected output?

the from/to/limit filters are working as its supposed to and i already monitored the output while to tests occur and my outputs are all correct, yet fcc doesnt allow me to pass the last test.

ive google alot and it seems like a lot of people cannot get through the last test even though their code is correct so i assume that this is a error of the testing system.

please do something about this, i want to move on to the last project

solution: boilerplate-project-exercisetracker - Nix (beta) Repl - Replit

Your browser information:

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

Challenge: Back End Development and APIs Projects - Exercise Tracker

Link to the challenge:

Nope, it’s your code. I’ve logged route inputs and outputs in your GET log and POST exercise and adding debugging to the POST at the obvious places and get this transcript:

creating exercise
req.body: {"description":"test","duration":"60","date":"1990-01-01"}
req.params: {"_id":"62f7f48225de07da46319c53"}
req.query: {}
got user
got exercise
i don't think there are dupe exercises
exercise created
exercise saved
{
  _id: '62f7f48225de07da46319c53',
  username: 'fcc_test_16604171543',
  date: 'Mon Jan 01 1990',
  duration: 60,
  description: 'test'
}
creating exercise
req.body: {"description":"test","duration":"60","date":"1990-01-03"}
req.params: {"_id":"62f7f48225de07da46319c53"}
req.query: {}
got user
got exercise
logging exercises
req.body: {}
req.params: {"_id":"62f7f48225de07da46319c53"}
req.query: {"from":"1989-12-31","to":"1990-01-04"}
[{"_id":"62f7f48225de07da46319c57","description":"test","duration":60,"date":"Mon Jan 01 1990"}]
{
  username: 'fcc_test_16604171543',
  count: 1,
  _id: '62f7f48225de07da46319c53',
  log: [
    {
      _id: new ObjectId("62f7f48225de07da46319c57"),
      description: 'test',
      duration: 60,
      date: 'Mon Jan 01 1990'
    }
  ]
}

The final test creates two exercise records for log testing. Since the second exercise doesn’t get created (your POST bails on a duplicate since there’s no i don't think there are dupe exercises on the second), the tests fail.