Can't pass FCC Exercise Tracker Project even though everything looks right on my end

Tell us what’s happening:
Describe your issue in detail here.

I seem to be failing half the tests for this project. However I’m returning all expected results the test questions ask for.

Am I missing something or are the FCC tests wonky for this project?

This is the last project I need to complete to get certificate, please help!

Your project link(s)

solution: https://replit.com/@mazorSharp/Exercise-Tracker?v=1

Your browser information:

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

Challenge: Exercise Tracker

Link to the challenge:

It would be helpful if you could attach the screenshot of tests that are failing.
right now it’s hard to tell what’s going on.

2 errors I see in the console that I can’t figure out how to bypass.

  1. at processTicksAndRejections (internal/process/task_queues.js:79:11) {
    stringValue: ‘“Invalid Date”’,
    messageFormat: undefined,
    kind: ‘date’,
    value: Invalid Date,
    path: ‘date’,
    reason: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

     assert.ok(!isNaN(value.valueOf()))
    

// For some reason one of the console.logs i have for debugging verifies that Date is checked but later on console logs it as ‘Invalid Date’. Same console.log but different results.

  1. Cannot read property ‘username’ of null

since most of the failing cases are related to GET request,
there may be something wrong with the mongodb query.

can you try to remove null from

ExerciseInfo.find((query), null, {limit: limitChecker(+limit)}, callback);

try:
ExerciseInfo.find(query, {limit: limitChecker(+limit)}, callback);

unfortunately it didn’t fix it, thanks for trying.

1 Like

I’ve checked your code and it seems to be working?

That’s what I thought too, its not passing test though.

i saw a code earlier, i think its different from the ones you have now.

I wanted to help you :). Im debugging now.
It’s not a problem. I made a copy.

1 Like

I’m currently trying to debug it, if it’s interrupting your ability to see code I can take a pause

Problems in your new code:

/api/users/:_id/exercises

  • Gives you invalid date
  • FCC do not enter date

Solution:

let checkedDate = new Date(/\d\d\d\d-\d\d-\d\d/.test(req.body.date)?req.body.date:Date.now());

*above is a new Date for either req.body.date or current date
*also used regular expression to look for a valid date

Exercise Schema & Log Schema
*Maybe you want to use the _id of the user instead of username
*why?

  1. because thats is what you are looking for in your search.
  2. relational database :))

Thanks Damien! I don’t know how I missed that No Date Entered edge case but it definitely helps. It’s only failing one test now but I’ll rewrite it tomorrow the way you suggested and take it from there:)

Says here: