{"action":"created","issue":{"url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/121","labels_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/121/labels{/name}","comments_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/121/comments","events_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/121/events","html_url":"https://github.com/moneyadviceservice/mas-rad_core/pull/121","id":115848875,"number":121,"title":"Firm indexer","user":{"login":"munckymagik","id":306583,"avatar_url":"https://avatars.githubusercontent.com/u/306583?v=3","gravatar_id":"","url":"https://api.github.com/users/munckymagik","html_url":"https://github.com/munckymagik","followers_url":"https://api.github.com/users/munckymagik/followers","following_url":"https://api.github.com/users/munckymagik/following{/other_user}","gists_url":"https://api.github.com/users/munckymagik/gists{/gist_id}","starred_url":"https://api.github.com/users/munckymagik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/munckymagik/subscriptions","organizations_url":"https://api.github.com/users/munckymagik/orgs","repos_url":"https://api.github.com/users/munckymagik/repos","events_url":"https://api.github.com/users/munckymagik/events{/privacy}","received_events_url":"https://api.github.com/users/munckymagik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-09T10:31:21Z","updated_at":"2015-11-09T14:25:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/121","html_url":"https://github.com/moneyadviceservice/mas-rad_core/pull/121","diff_url":"https://github.com/moneyadviceservice/mas-rad_core/pull/121.diff","patch_url":"https://github.com/moneyadviceservice/mas-rad_core/pull/121.patch"},"body":"## Summary\r\n\r\nThis PR introduces a home for the logic relating to indexing firms. In the existing system this was spread around between advisers, firms and the geocoding jobs and the index firm job.\r\n\r\nThe `FirmIndexer` (for want of a better name) is now *THE* only thing that knows the logic about when and how a firm is indexed to ElasticSearch. The models simplify notify it in `on_commit` handlers that something has changed and it then works out the required outcome from what it gets given.\r\n\r\n## Consequences\r\n\r\nAt this point indexing is no longer done on an ActiveJob. We could easily put this back in (which is why I've not deleted the job classes in this PR), but we need to prove that doing this on a background job is actually necessary.\r\n\r\n## Next work\r\n\r\n* The `Adviser` has not yet been fully converted over. That will be done next.\r\n* The `Firm` still has lat/long fields, includes Geocodable, and delegates address fields to main office. This needs to be taken out.\r\n* I'd feel more comfortable if we had a integration test that exercises a few of the indexing/geocoding scenarios end to end.\r\n* We need to expose the office coordinates to ElasticSearch.\r\n* We need to think about migrating existing geo data from firms to the main offices."},"comment":{"url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/comments/155077837","html_url":"https://github.com/moneyadviceservice/mas-rad_core/pull/121#issuecomment-155077837","issue_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/121","id":155077837,"user":{"login":"JiggyPete","id":67151,"avatar_url":"https://avatars.githubusercontent.com/u/67151?v=3","gravatar_id":"","url":"https://api.github.com/users/JiggyPete","html_url":"https://github.com/JiggyPete","followers_url":"https://api.github.com/users/JiggyPete/followers","following_url":"https://api.github.com/users/JiggyPete/following{/other_user}","gists_url":"https://api.github.com/users/JiggyPete/gists{/gist_id}","starred_url":"https://api.github.com/users/JiggyPete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JiggyPete/subscriptions","organizations_url":"https://api.github.com/users/JiggyPete/orgs","repos_url":"https://api.github.com/users/JiggyPete/repos","events_url":"https://api.github.com/users/JiggyPete/events{/privacy}","received_events_url":"https://api.github.com/users/JiggyPete/received_events","type":"User","site_admin":false},"created_at":"2015-11-09T14:25:38Z","updated_at":"2015-11-09T14:25:38Z","body":":+1: "}}