Project Exercise Tracker

Tell us what’s happening:
Greetings.
I was having trouble with Date datatype for mongodb, so I saved the date as unix timestamp and perform conversion whenever I have to display. My code fails all tests that involve handling date(except last one as I havent implemented it yet), although my output does matches the requirement.

Appreciate any help.

Your project link(s)

githubLink: GitHub - iitdelhi2017/boilerplate-project-exercisetracker: A boilerplate for a freeCodeCamp project.
solution: https://replit.com/@iitdelhi2017/boilerplate-project-exercisetracker-2

Your browser information:

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

Challenge: Exercise Tracker

Link to the challenge:

Hello there,

When I run your code, I see these errors in the console:

Typically, this comes about due to your app crashing part way through the tests. Usually, because of an unhandled error.

Specifically, I can see this is an issue:

Person.findOne({"_id":req.body[':_id']

Hope this helps

Great help! thank you. I have successfully finished this project.

But I have a doubt. While debugging, I used 2 different statements.

  1. if(data!=null)
  2. if(data.exercise.length>0)

where data is object received in callback function.
Although both evaluated to true during debugging, I got test timed out with statement 1 but not with statement 2.
What could be the reason? Or is there something else?

Repl link:https://replit.com/@iitdelhi2017/boilerplate-project-exercisetracker-3

Once again, great thanks for your help.

The issue is how you are handling the error:

Person.findOne({_id:req.params._id},function(err,data){
    if(err) console.error(err);
    var logs=[];
    if(data.exercise.length>0)

If you encounter an error, you should return from the function. NOT continue to look for the data. The same goes for other callbacks you have.

Hope this helps

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