4 Days, can't solv: Exercise Tracker - Tests 8 & 15 not passing

Thanks again, I feel like I’m doing exactly what you are suggesting, yet it still doesn’t pass.

I’m not sure what version of you code you debugged, but my latest version, looks like this for my .map loop:


      let test = workingLog.map(item => {
        return (
          {
            description: item.description,
            duration: item.duration,
            date: item.date.toDateString()
          }
        )
      })

and my return

      let exerciseLog = {
        "username": user.username,
        "_id": user._id,
        "count": workingLog.length,
        "log": test
      }
      console.log("exerciselog: ", exerciseLog);

      res.status(201).json(exerciseLog);

And this is the output, yet it still isn’t passing. This is the last test. What does it look like i am missing? FWIW, I have also tried using JSON.parse() to get rid of the string notation of the keys, but I am getting an error with that. I’ve tried using res.send as well as res.json, and the result is the same both ways with the values in string notation.

I’m really stumped.

{
"username": "Archie",
"_id": "63d8884b25006df0edab6d03",
"count": 3,
"log": [
{
"description": "sleeping",
"duration": 56,
"date": "Sat Jan 01 2022"
},
{
"description": "running",
"duration": 120,
"date": "Sun Jan 02 2022"
},
{
"description": "barking",
"duration": 3,
"date": "Mon Jan 03 2022"
}
]
}

This is the test not passing:
The date property of any object in the log array that is returned from GET /api/users/:_id/logs should be a string. Use the dateString format of the Date API.

And the expected return:

{
  username: "fcc_test",
  count: 1,
  _id: "5fb5853f734231456ccb3b05",
  log: [{
    description: "test",
    duration: 60,
    date: "Mon Jan 01 1990",
  }]
}

This is my final update, I passsed! BUT. I made ZERO changes since the last time I posted, I just thought I’d come back and check things out before going to bed and now it passes.

I’ve read other threads on this specific exercise where they resubmitted their project the next day and it passed without making new changes. Very frustrating and not conducive to learning…

HOWEVER I truly appreciate the time you guys put into helping me sort it out.

And after 4 years or so, I’ve finally earned my back end API certification!!

3 Likes

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