Issue tracker FreeCodeCamp is not finishing

Tell us what’s happening:
Describe your issue in detail here.
there are 2 requirements that i am still unable to fulfill :slight_smile:

  • You can send a GET request to /api/issues/{projectname} and filter the request by also passing along any field and value as a URL query (ie. /api/issues/{project}?open=false ). You can pass one or more field/value pairs at once.

-. You can send a DELETE request to /api/issues/{projectname} with an _id to delete an issue. If no _id is sent, the return value is { error: 'missing _id' } . On success, the return value is { result: 'successfully deleted', '_id': _id } . On failure, the return value is { error: 'could not delete', '_id': _id } .

I’m pretty sure everything is as it should be, i’ve watched tutorials to see where i did wrong but i didn’t find anything.

Your project link(s)

solution: routes/api.js - boilerplate-project-issuetracker-1 - 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.5060.53 Safari/537.36 Edg/103.0.1264.37

Challenge: Issue Tracker

Link to the challenge:

The first GET test isn’t using any filters so I don’t believe you should be asserting the open property on it.

The DELETE is passing for me.

i do not see any filters being used on the .GET command

I’m talking about the ?open=false

You can send a GET request to /api/issues/{projectname} for an array of all issues for that specific projectname , with all the fields present for each issue.

Not all of them will have the open property. Just don’t assert for the open property on the first GET test. That should let you pass.

i’m sorry but i still do not understand.

Your code is passing for me now.

I assume you added the NODE_ENV=test environment variable?

yes i set on the NODE_ENV i put in “testd” so that i didn’t get so many console log from restarting the project

It has to be set correctly when submitting.

i understand, the part that i do not understand is the GET part.

Like I said your code should be passing, does it not pass for you?

Or does it pass now but you don’t understand why?

on my test, this one has yet to pass,

You can send a `GET` request to `/api/issues/{projectname}` and filter the request by also passing along any field and value as a URL query (ie. `/api/issues/{project}?open=false` ). You can pass one or more field/value pairs at once.

and also the DELETE is unstable, sometimes it works, while other times it doesn’t

You can send a DELETE request to /api/issues/{projectname} with an _id to delete an issue. If no _id is sent, the return value is { error: 'missing _id' }. On success, the return value is { result: 'successfully deleted', '_id': _id }. On failure, the return value is { error: 'could not delete', '_id': _id }.

It passed for me. But I did also have to run it twice to get the DELETE to pass.

But I had no issue with the functional tests. Do the functional tests pass for you when running them, just not when submitting them?

the functional test passed for me.

the DELETE test sometimes passed.

while the GET test fail.

Odd, that test passes for me (using my own DB).

Maybe try deleting the collection and start with a fresh one. You can also try inspecting the network in the browser and look at the response for that request.

might i ask, did you change any part of my code, that’s why it worked for you?

if yes may i know what the changes you made,

i have deleted the collection on mongodb atlas.

i tried inspecting the network, but i didn’t see anything.

No I just added the environment variables and used my own DB

What do you mean you didn’t see anything?

You can try looking at the tests and see what is expected and what you are responding with.

i tried changing the GET method, it still doesn’t work

app.route('/api/issues/:project')
  
    .get(function (req, res){
      let projectName = req.params.project;
      let {issue_title,issue_text,created_by,assigned_to,status_text,open,_id,created_on,updated_on} = req.query
      let filterObject = Object.assign(req.query)
      filterObject['name'] = projectName
      console.log(filterObject)
      Issue.find(filterObject,(err,projectData)=>{
        if(err||!projectData){
          console.log(err)
          res.json([])
        }else if(projectData){
          res.json(projectData)
        }
      })
    })

As I said, the code was passing for me with my own DB so it’s not likely to be the code that is the problem. Try using a VPN and see if it helps (it’s weird but it helps for some people).

i downloaded the replit and i moved it to codesandbox, and it worked, thank you

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