{"action":"closed","issue":{"url":"https://api.github.com/repos/ckan/ckanext-harvest/issues/205","labels_url":"https://api.github.com/repos/ckan/ckanext-harvest/issues/205/labels{/name}","comments_url":"https://api.github.com/repos/ckan/ckanext-harvest/issues/205/comments","events_url":"https://api.github.com/repos/ckan/ckanext-harvest/issues/205/events","html_url":"https://github.com/ckan/ckanext-harvest/issues/205","id":119552366,"number":205,"title":"Inconsistent report_status keys","user":{"login":"davidread","id":307612,"avatar_url":"https://avatars.githubusercontent.com/u/307612?v=3","gravatar_id":"","url":"https://api.github.com/users/davidread","html_url":"https://github.com/davidread","followers_url":"https://api.github.com/users/davidread/followers","following_url":"https://api.github.com/users/davidread/following{/other_user}","gists_url":"https://api.github.com/users/davidread/gists{/gist_id}","starred_url":"https://api.github.com/users/davidread/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidread/subscriptions","organizations_url":"https://api.github.com/users/davidread/orgs","repos_url":"https://api.github.com/users/davidread/repos","events_url":"https://api.github.com/users/davidread/events{/privacy}","received_events_url":"https://api.github.com/users/davidread/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-30T18:34:33Z","updated_at":"2015-12-10T13:39:22Z","closed_at":"2015-12-10T13:39:22Z","body":"`HarvestObject.report_status` can take values:\r\n\r\n    'added', 'updated', 'not modified', 'deleted', 'errored'\r\n\r\nWhen you look at a job (`harvest_job_show`, `harvest_job_list`, `harvest_source_show_status['last_job']`) it can report the 'stats' - counts of the job objects' report_statuses - which are returned using the same keys. (Uses `harvest_job_dictize()`)\r\n\r\nHowever `harvest_source_list` and `harvest_source_for_a_dataset` has a `source['status']['last_harvest_statistics']` (Uses `harvest_source_dictize`) but returns slightly different keys:\r\n\r\n    'added', 'updated', 'errors', 'deleted'\r\n\r\n('not modified' has not been added and 'errors' instead of 'errored')\r\n\r\n@metaodi and I think we should make them consistent. We discussed this breaking change on https://github.com/ckan/ckanext-harvest/pull/200. I said:\r\n\r\n> I don't think anything is done with the job stats, apart from displayed, so maybe it's ok to change. Do you think extensions would use them? Were you looking at the stats when you thought to do #192?\r\n\r\nHe said:\r\n\r\n> Well, we're building a WordPress extension as an \"admin interface\" for harvesters. So yes, we are consuming and using the API and therefore noticed these inconsistencies.\r\nThat said, I think it would be great to be consistent and I frankly think there are not a lot of extensions using the harvester API. At least not enough to not change this. What's your impression?\r\n\r\nI agree that there is likely hardly any use of the report_status so far, so it is well worth us making it consistent.\r\n\r\nFurthermore, the 2 logic functions which return `errors` are ripe for change anyway:\r\n\r\n    harvest_source_list - TODO: Use package search\r\n    harvest_source_for_a_dataset - TODO: Deprecated, harvest source id is added as an extra to each dataset\r\n\r\nSo those are both going to go anyway. They both are the only callers of `harvest_source_dictize` which is marked `TODO: Deprecated` and that is the only caller of `_get_source_status` which is marked `TODO: Deprecated, use harvest_source_show_status instead`\r\n\r\nIndeed we see from the after_show() method that the Package has the `status` key added:\r\n\r\n    data_dict['status'] = p.toolkit.get_action('harvest_source_show_status')(context, {    'id': source.id})\r\n\r\nwhich will have the key 'errored'. i.e. the key 'errored' will go when these TODOs are done anyway.\r\n\r\nSo let's just fix it now shall we?\r\n\r\n`harvest_source_list` always returns `'last_harvest_statistics': {'added': 0, 'updated': 0, 'errors': 0, 'deleted': 0}` because it doesn't fill in the values because it sets context['detailed'] to False. So we can just get rid of 'last_harvest_statistics' key.\r\n\r\n`harvest_source_for_a_dataset` can just be deleted completely now.\r\n\r\nDoes that seem reasonable @metaodi and @amercader ?"}}