Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove_org_units falsely reports success #13

Open
hardingt opened this issue Jan 26, 2017 · 1 comment
Open

remove_org_units falsely reports success #13

hardingt opened this issue Jan 26, 2017 · 1 comment

Comments

@hardingt
Copy link

hardingt commented Jan 26, 2017

Timothys-MacBook-Pro:dish2 tharding$ node bin/remove_org_units.js --file /Users/tharding/Documents/dish_files/playdev/removeme.csv 
Using DHIS2_HOME environment variable pointing to: /Users/tharding/Documents/dish_files/playdev/dish.json
Data for org unit successfully deleted, id: DiszpKrYNg8, name: undefined
Org unit successfully deleted: DiszpKrYNg8, undefined
Process completed!
Org units deleted: 1
Total no of org units: 1
Errors occured: 0
Timothys-MacBook-Pro:dish2 tharding$ 

But visiting:
https://play.dhis2.org/dev/api/26/organisationUnits/DiszpKrYNg8.json

Shows it still there.

Also note that rerunning it will give the exact same output.

@hardingt
Copy link
Author

hardingt commented Jan 26, 2017

I made a small change while debugging and you can see the return code is 404:

Using DHIS2_HOME environment variable pointing to: /Users/tharding/Documents/dish_files/playdev/dish.json
Data for org unit successfully deleted, id: undefined, name: Ngelehun CHC
{ type: 'buffer',
  status: 404,
  headers: 
   { server: 'nginx/1.4.6 (Ubuntu)',
     date: 'Thu, 26 Jan 2017 17:20:34 GMT',

Curious, I checked out the code checker in configManager.js:

cnf.is2xx = function(code) {
  return parseInt(code/100);
}

which returns the 100s place it looks like, rather than if the number is between 200 and 299.

console.log(conf.is2xx(delOuResp.status));
4

Suggest we edit this function to return FALSE (or the JS equivalent) if not between 200 and 299

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant