{"action":"created","issue":{"url":"https://api.github.com/repos/azerbini/eamena_dev/issues/38","repository_url":"https://api.github.com/repos/azerbini/eamena_dev","labels_url":"https://api.github.com/repos/azerbini/eamena_dev/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/azerbini/eamena_dev/issues/38/comments","events_url":"https://api.github.com/repos/azerbini/eamena_dev/issues/38/events","html_url":"https://github.com/azerbini/eamena_dev/issues/38","id":341941259,"node_id":"MDU6SXNzdWUzNDE5NDEyNTk=","number":38,"title":"Create alert if a resource is created in the same location as a pre-existing resource of the same type","user":{"login":"azerbini","id":19243127,"node_id":"MDQ6VXNlcjE5MjQzMTI3","avatar_url":"https://avatars3.githubusercontent.com/u/19243127?v=4","gravatar_id":"","url":"https://api.github.com/users/azerbini","html_url":"https://github.com/azerbini","followers_url":"https://api.github.com/users/azerbini/followers","following_url":"https://api.github.com/users/azerbini/following{/other_user}","gists_url":"https://api.github.com/users/azerbini/gists{/gist_id}","starred_url":"https://api.github.com/users/azerbini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azerbini/subscriptions","organizations_url":"https://api.github.com/users/azerbini/orgs","repos_url":"https://api.github.com/users/azerbini/repos","events_url":"https://api.github.com/users/azerbini/events{/privacy}","received_events_url":"https://api.github.com/users/azerbini/received_events","type":"User","site_admin":false},"labels":[{"id":576990264,"node_id":"MDU6TGFiZWw1NzY5OTAyNjQ=","url":"https://api.github.com/repos/azerbini/eamena_dev/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-07-17T14:21:20Z","updated_at":"2018-07-23T14:29:21Z","closed_at":null,"author_association":"OWNER","body":"https://github.com/azerbini/eamena_v3/issues/96\r\n\r\nThe point of this enhancement is to make sure that resources of the same type are not duplicated by means of human error (people adding the same thing twice). When a user saves a new resource in a certain location, we would want the app to interrogate the database and make sure that instances of the same resource type do not exist already within the same geometry **or** in a small radius around it. The radius would be variable for settings.py. \r\n\r\nThe workflow would be as follows:\r\n\r\nFront-end: user saves\r\n\r\nBack-end: query to geometries table, within radius. If anything is returned, pass back to the front-end some JSON containing the primaryname of the resources within the radius, and their UUIDs\r\n\r\nFront-end: if anything returned, give an alert listing the primarynames as URLs, otherwise just save the resource and carry on."},"comment":{"url":"https://api.github.com/repos/azerbini/eamena_dev/issues/comments/407077753","html_url":"https://github.com/azerbini/eamena_dev/issues/38#issuecomment-407077753","issue_url":"https://api.github.com/repos/azerbini/eamena_dev/issues/38","id":407077753,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzA3Nzc1Mw==","user":{"login":"azerbini","id":19243127,"node_id":"MDQ6VXNlcjE5MjQzMTI3","avatar_url":"https://avatars3.githubusercontent.com/u/19243127?v=4","gravatar_id":"","url":"https://api.github.com/users/azerbini","html_url":"https://github.com/azerbini","followers_url":"https://api.github.com/users/azerbini/followers","following_url":"https://api.github.com/users/azerbini/following{/other_user}","gists_url":"https://api.github.com/users/azerbini/gists{/gist_id}","starred_url":"https://api.github.com/users/azerbini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azerbini/subscriptions","organizations_url":"https://api.github.com/users/azerbini/orgs","repos_url":"https://api.github.com/users/azerbini/repos","events_url":"https://api.github.com/users/azerbini/events{/privacy}","received_events_url":"https://api.github.com/users/azerbini/received_events","type":"User","site_admin":false},"created_at":"2018-07-23T14:29:21Z","updated_at":"2018-07-23T14:29:21Z","author_association":"OWNER","body":"@TeriForey , we want the function to run every time a POST request involves the **addition** or  **change** of the inspected node types (in our case, the geometry nodes). When this occurs, and if the query returns results, then the POST should not lead to any saving of new resources, but rather return JSON back to forms load, so that I can take the JSON to populate the alert when the form is reloaded at the end of the POST. Moreover, it should be the case that, in the case a JSON alert is returned, the edits present in the POST request are returned to the forms load method, so that they can be picked up by the view model and repopulate the front end without the user having to re-enter everything, if he/she is certain that the record is not a duplicate.\r\n\r\nI can see from your PR that you have gone ahead and used a logic that queries the Django db model. I thought you said it did not perform too well at scale?"}}
{"actor":{"display_login":"azerbini"}}