{"action":"created","issue":{"url":"https://api.github.com/repos/CartoDB/cartodb/issues/7578","repository_url":"https://api.github.com/repos/CartoDB/cartodb","labels_url":"https://api.github.com/repos/CartoDB/cartodb/issues/7578/labels{/name}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/issues/7578/comments","events_url":"https://api.github.com/repos/CartoDB/cartodb/issues/7578/events","html_url":"https://github.com/CartoDB/cartodb/pull/7578","id":157646333,"number":7578,"title":"7494 analysis form models","user":{"login":"viddo","id":978461,"avatar_url":"https://avatars.githubusercontent.com/u/978461?v=3","gravatar_id":"","url":"https://api.github.com/users/viddo","html_url":"https://github.com/viddo","followers_url":"https://api.github.com/users/viddo/followers","following_url":"https://api.github.com/users/viddo/following{/other_user}","gists_url":"https://api.github.com/users/viddo/gists{/gist_id}","starred_url":"https://api.github.com/users/viddo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viddo/subscriptions","organizations_url":"https://api.github.com/users/viddo/orgs","repos_url":"https://api.github.com/users/viddo/repos","events_url":"https://api.github.com/users/viddo/events{/privacy}","received_events_url":"https://api.github.com/users/viddo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-05-31T11:10:08Z","updated_at":"2016-06-02T11:04:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CartoDB/cartodb/pulls/7578","html_url":"https://github.com/CartoDB/cartodb/pull/7578","diff_url":"https://github.com/CartoDB/cartodb/pull/7578.diff","patch_url":"https://github.com/CartoDB/cartodb/pull/7578.patch"},"body":"Yes, a big PR because the issues above were all related to the problems of current implementation, so solved them in one go.\r\n\r\nThe main benefit, though, is that it will be easy for others (who don't know how things are wired together), to add new analyses 🎉 they just need to:\r\n\r\n1. add a [new option entry](https://github.com/CartoDB/cartodb/blob/7494-analysis-form-models/lib/assets/javascripts/cartodb3/components/modals/add-analysis/default-options.js)\r\n1. Implement a [form model(+view to go with it) representing the new type](https://github.com/CartoDB/cartodb/blob/7494-analysis-form-models/lib/assets/javascripts/cartodb3/editor/layers/layer-content-views/analyses/analysis-forms-collection.js#L6-L10)\r\n\r\nMore details below:\r\n\r\n**Closes #7494 - Change analysis nodes creation/update to work with form models**\r\nThe layer-contenta-analyses-view now works with form models instead of directly interacting with the node definitions. This have the benefit of having invalid models w/ trouble, and representing editing state in a simpler way and not polluting the node models.\r\n\r\nAlso simplifies add-analysis modal, since it now just need to add metadata about an analysis. In theory we should be able to move this to the camshaft reference even, having all the the options generated from the metadata. This also solved the bug of showing the secondary source as an error when creating a new point-in-polygon analysis. 🎉 \r\n\r\nValidation is now also done using the params restrictions defined in the [camshaft reference](https://github.com/CartoDB/camshaft/blob/master/reference/versions/0.10.0/reference.json)\r\n\r\n**Closes #7517 - [analysis] trade areas not working with time**\r\nThe form converts the model's values to strings (`123`, `false`, etc.). Solved by doing conversion based on the [type definitions in the camshaft reference](https://github.com/CartoDB/camshaft/blob/master/reference/versions/0.10.0/reference.json#L13).\r\n\r\n**Closes #7468 - Render analysis controls view at bottom**\r\nChanged the layout structure, and could remove some unnecessary views. The hierarchy now is basically:\r\n\r\n```\r\nLayerContentAnalyses\r\n  ScrollView\r\n    ListView\r\n      Workflow\r\n      Form\r\n  AnalysesControls (apply etc.)\r\n```\r\n\r\nAlso some general boyscouting while at it, e.g. stack layout bugs, node internals, duplicated code (add-analysis modal creation) etc.\r\n\r\n---\r\n\r\nSome screens:\r\n\r\n![screen shot 2016-05-31 at 16 41 57](https://cloud.githubusercontent.com/assets/978461/15678471/c33c0dc2-274e-11e6-87e7-d6f498e7ad44.png)\r\n![screen shot 2016-05-31 at 16 42 02](https://cloud.githubusercontent.com/assets/978461/15678472/c3495b6c-274e-11e6-9e71-b6520ce9a56c.png)\r\n![screen shot 2016-05-31 at 16 42 06](https://cloud.githubusercontent.com/assets/978461/15678473/c36b7850-274e-11e6-8759-35b95075d80f.png)\r\n![screen shot 2016-05-31 at 16 42 20](https://cloud.githubusercontent.com/assets/978461/15678474/c36f1a6e-274e-11e6-86e6-0af8724ed65a.png)\r\n\r\n@xavijam sorry for such a large PR again, but can you review? 🙏 🙇 \r\ncc @javierarce @alonsogarciapablo "},"comment":{"url":"https://api.github.com/repos/CartoDB/cartodb/issues/comments/223260861","html_url":"https://github.com/CartoDB/cartodb/pull/7578#issuecomment-223260861","issue_url":"https://api.github.com/repos/CartoDB/cartodb/issues/7578","id":223260861,"user":{"login":"xavijam","id":132146,"avatar_url":"https://avatars.githubusercontent.com/u/132146?v=3","gravatar_id":"","url":"https://api.github.com/users/xavijam","html_url":"https://github.com/xavijam","followers_url":"https://api.github.com/users/xavijam/followers","following_url":"https://api.github.com/users/xavijam/following{/other_user}","gists_url":"https://api.github.com/users/xavijam/gists{/gist_id}","starred_url":"https://api.github.com/users/xavijam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xavijam/subscriptions","organizations_url":"https://api.github.com/users/xavijam/orgs","repos_url":"https://api.github.com/users/xavijam/repos","events_url":"https://api.github.com/users/xavijam/events{/privacy}","received_events_url":"https://api.github.com/users/xavijam/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T11:04:16Z","updated_at":"2016-06-02T11:04:16Z","body":"SFW -> Sweden for the win."}}
{"actor":{"display_login":"xavijam"}}