Quality Assurance Projects - Issue Tracker- correct update but wont pass the test

Tell us what’s happening:
I have been stuck at PUT request.

You can send a PUT request to /api/issues/{projectname} with an _id and one or more fields to update. On success, the updated_on field should be updated, and returned should be { result: 'successfully updated', '_id': _id }

I have been logging the result of the update it shows the update as success and values also changed. But it is not passing the test. I am not sure what is causing the problem.

here update starts
here update ends {
  _id: new ObjectId("635b62361138e801bee6bbca"),
  issue_title: 'Issue to be Updated',
  issue_text: 'New Issue Text',
  created_on: 2022-10-28T05:01:19.345Z,
  updated_on: 2022-10-28T05:01:43.684Z,
  created_by: 'fCC',
  assigned_to: '',
  open: true,
  status_text: '',
  project_name: 'fcc-project',
  __v: 0
}

Your project link(s)

solution: boilerplate-project-issuetracker - Node.js Repl - Replit

Your browser information:

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

Challenge: Quality Assurance Projects - Issue Tracker

Link to the challenge:

issue before update {
  _id: new ObjectId("6363694815d7014c099d90b0"),
  issue_title: 'Issue to be Updated',
  issue_text: 'Functional Test - Put target',
  created_on: 2022-11-03T07:09:31.058Z,
  updated_on: 2022-11-03T07:09:31.058Z,
  created_by: 'fCC',
  assigned_to: '',
  open: true,
  status_text: '',
  project_name: 'fcc-project',
  __v: 0
}

fields to update { issue_text: 'New Issue Text' }

issue after update {
  _id: new ObjectId("6363694815d7014c099d90b0"),
  issue_title: 'Issue to be Updated',
  issue_text: 'New Issue Text',
  created_on: 2022-11-03T07:09:31.058Z,
  updated_on: 2022-11-03T07:10:01.493Z,
  created_by: 'fCC',
  assigned_to: '',
  open: true,
  status_text: '',
  project_name: 'fcc-project',
  __v: 0
}

It seems to be updating correctly but it does not pass the test.

Finally figured it out.
There seems to be an error in my GET request.
After updating the results are checked through GET request.
I have not included _id in my GET request which is parameter for checking successful update.
After including _id in my GET test is cleared up.

this was my issue too. Thanks so much.

1 Like

it seems i may have the same problem.
can I ask, how did you include _id in GET request ? (where)

In get request you are finding issue with diff variables, you have to also include _id paramater for finding new issue, put request uses that _id to call get method, to check whether issue has been updated.

1 Like

[details="Summary"]
type or paste code here
[/details]