{"action":"created","comment":{"url":"https://api.github.com/repos/keen/explorer/pulls/comments/44311889","id":44311889,"diff_hunk":"@@ -84,6 +101,99 @@ function _getDefaultFilterCoercionType(explorer, filter) {\n }\n \n /**\n+ * Runs through the changeset and moves data around if necessary\n+ * @param {Object} explorer   The explorer model that is being updated\n+ * @param {Object} updates    The updated explorer model\n+ * @return {Object}           The new set of updates\n+ */\n+function _prepareUpdates(explorer, updates) {\n+  var newModel = _.assign({}, explorer, updates);\n+\n+  newModel = _removeEmailExtractionFields(explorer, newModel);\n+  newModel = _migrateToFunnel(explorer, newModel);\n+  newModel = _migrateFromFunnel(explorer, newModel);","path":"client/js/app/stores/ExplorerStore.js","position":38,"original_position":38,"commit_id":"5c60571ed3f0947dea11804a8ce8f1e47fba9955","original_commit_id":"5c60571ed3f0947dea11804a8ce8f1e47fba9955","user":{"login":"aroc","id":735257,"avatar_url":"https://avatars.githubusercontent.com/u/735257?v=3","gravatar_id":"","url":"https://api.github.com/users/aroc","html_url":"https://github.com/aroc","followers_url":"https://api.github.com/users/aroc/followers","following_url":"https://api.github.com/users/aroc/following{/other_user}","gists_url":"https://api.github.com/users/aroc/gists{/gist_id}","starred_url":"https://api.github.com/users/aroc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aroc/subscriptions","organizations_url":"https://api.github.com/users/aroc/orgs","repos_url":"https://api.github.com/users/aroc/repos","events_url":"https://api.github.com/users/aroc/events{/privacy}","received_events_url":"https://api.github.com/users/aroc/received_events","type":"User","site_admin":false},"body":"This code reads really weird. The fact that we call `migrateToFunnel` then immediately after `migrateFromFunnel` is a confusing read. It might make sense to do the check in this function and then only call one or the other. While three lines in a row like this is nice and clean, having to read those other functions to understand why these 2 lines don't contradict themselves isn't the best.\r\n\r\nThese function names are nice and clear to me on their own, so leveraging an if statement here and only calling one or the other would make for a great and clear read of what's going on.","created_at":"2015-11-09T18:38:32Z","updated_at":"2015-11-09T18:38:32Z","html_url":"https://github.com/keen/explorer/pull/37#discussion_r44311889","pull_request_url":"https://api.github.com/repos/keen/explorer/pulls/37","_links":{"self":{"href":"https://api.github.com/repos/keen/explorer/pulls/comments/44311889"},"html":{"href":"https://github.com/keen/explorer/pull/37#discussion_r44311889"},"pull_request":{"href":"https://api.github.com/repos/keen/explorer/pulls/37"}}},"pull_request":{"url":"https://api.github.com/repos/keen/explorer/pulls/37","id":49707412,"html_url":"https://github.com/keen/explorer/pull/37","diff_url":"https://github.com/keen/explorer/pull/37.diff","patch_url":"https://github.com/keen/explorer/pull/37.patch","issue_url":"https://api.github.com/repos/keen/explorer/issues/37","number":37,"state":"open","locked":false,"title":"Funnel data model","user":{"login":"josephwegner","id":657707,"avatar_url":"https://avatars.githubusercontent.com/u/657707?v=3","gravatar_id":"","url":"https://api.github.com/users/josephwegner","html_url":"https://github.com/josephwegner","followers_url":"https://api.github.com/users/josephwegner/followers","following_url":"https://api.github.com/users/josephwegner/following{/other_user}","gists_url":"https://api.github.com/users/josephwegner/gists{/gist_id}","starred_url":"https://api.github.com/users/josephwegner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josephwegner/subscriptions","organizations_url":"https://api.github.com/users/josephwegner/orgs","repos_url":"https://api.github.com/users/josephwegner/repos","events_url":"https://api.github.com/users/josephwegner/events{/privacy}","received_events_url":"https://api.github.com/users/josephwegner/received_events","type":"User","site_admin":false},"body":"@aroc \r\n\r\n### What does this PR do? How does it affect users?\r\nThis adds the `ExplorerStore` logic for switching to & from funnel analysis types. Properties should flow in and out of the steps property when switching analysis types.\r\n\r\nThere's also a small refactor to use a set of update preparation functions, rather than making the `_update` function super chaotic.\r\n\r\n### How should this be tested (feature switches, URLs, special user permissions)?\r\nWell, unfortunately, you can't. There is no functional way to actually touch this code, because we don't actually have a funnel analysis_type yet. I'd suggest reading the tests thoroughly. If those make sense, and pass in CI, then we should be golden.","created_at":"2015-11-04T16:03:30Z","updated_at":"2015-11-09T18:38:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3306ef8e3413ed00dfe4c84005a65185055601ac","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/keen/explorer/pulls/37/commits","review_comments_url":"https://api.github.com/repos/keen/explorer/pulls/37/comments","review_comment_url":"https://api.github.com/repos/keen/explorer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/keen/explorer/issues/37/comments","statuses_url":"https://api.github.com/repos/keen/explorer/statuses/5c60571ed3f0947dea11804a8ce8f1e47fba9955","head":{"label":"keen:funnel-data-model","ref":"funnel-data-model","sha":"5c60571ed3f0947dea11804a8ce8f1e47fba9955","user":{"login":"keen","id":8461781,"avatar_url":"https://avatars.githubusercontent.com/u/8461781?v=3","gravatar_id":"","url":"https://api.github.com/users/keen","html_url":"https://github.com/keen","followers_url":"https://api.github.com/users/keen/followers","following_url":"https://api.github.com/users/keen/following{/other_user}","gists_url":"https://api.github.com/users/keen/gists{/gist_id}","starred_url":"https://api.github.com/users/keen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keen/subscriptions","organizations_url":"https://api.github.com/users/keen/orgs","repos_url":"https://api.github.com/users/keen/repos","events_url":"https://api.github.com/users/keen/events{/privacy}","received_events_url":"https://api.github.com/users/keen/received_events","type":"Organization","site_admin":false},"repo":{"id":37276906,"name":"explorer","full_name":"keen/explorer","owner":{"login":"keen","id":8461781,"avatar_url":"https://avatars.githubusercontent.com/u/8461781?v=3","gravatar_id":"","url":"https://api.github.com/users/keen","html_url":"https://github.com/keen","followers_url":"https://api.github.com/users/keen/followers","following_url":"https://api.github.com/users/keen/following{/other_user}","gists_url":"https://api.github.com/users/keen/gists{/gist_id}","starred_url":"https://api.github.com/users/keen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keen/subscriptions","organizations_url":"https://api.github.com/users/keen/orgs","repos_url":"https://api.github.com/users/keen/repos","events_url":"https://api.github.com/users/keen/events{/privacy}","received_events_url":"https://api.github.com/users/keen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keen/explorer","description":"Data Explorer by Keen IO","fork":false,"url":"https://api.github.com/repos/keen/explorer","forks_url":"https://api.github.com/repos/keen/explorer/forks","keys_url":"https://api.github.com/repos/keen/explorer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keen/explorer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keen/explorer/teams","hooks_url":"https://api.github.com/repos/keen/explorer/hooks","issue_events_url":"https://api.github.com/repos/keen/explorer/issues/events{/number}","events_url":"https://api.github.com/repos/keen/explorer/events","assignees_url":"https://api.github.com/repos/keen/explorer/assignees{/user}","branches_url":"https://api.github.com/repos/keen/explorer/branches{/branch}","tags_url":"https://api.github.com/repos/keen/explorer/tags","blobs_url":"https://api.github.com/repos/keen/explorer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keen/explorer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keen/explorer/git/refs{/sha}","trees_url":"https://api.github.com/repos/keen/explorer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keen/explorer/statuses/{sha}","languages_url":"https://api.github.com/repos/keen/explorer/languages","stargazers_url":"https://api.github.com/repos/keen/explorer/stargazers","contributors_url":"https://api.github.com/repos/keen/explorer/contributors","subscribers_url":"https://api.github.com/repos/keen/explorer/subscribers","subscription_url":"https://api.github.com/repos/keen/explorer/subscription","commits_url":"https://api.github.com/repos/keen/explorer/commits{/sha}","git_commits_url":"https://api.github.com/repos/keen/explorer/git/commits{/sha}","comments_url":"https://api.github.com/repos/keen/explorer/comments{/number}","issue_comment_url":"https://api.github.com/repos/keen/explorer/issues/comments{/number}","contents_url":"https://api.github.com/repos/keen/explorer/contents/{+path}","compare_url":"https://api.github.com/repos/keen/explorer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keen/explorer/merges","archive_url":"https://api.github.com/repos/keen/explorer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keen/explorer/downloads","issues_url":"https://api.github.com/repos/keen/explorer/issues{/number}","pulls_url":"https://api.github.com/repos/keen/explorer/pulls{/number}","milestones_url":"https://api.github.com/repos/keen/explorer/milestones{/number}","notifications_url":"https://api.github.com/repos/keen/explorer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keen/explorer/labels{/name}","releases_url":"https://api.github.com/repos/keen/explorer/releases{/id}","created_at":"2015-06-11T17:56:40Z","updated_at":"2015-11-08T17:23:32Z","pushed_at":"2015-11-09T15:16:14Z","git_url":"git://github.com/keen/explorer.git","ssh_url":"git@github.com:keen/explorer.git","clone_url":"https://github.com/keen/explorer.git","svn_url":"https://github.com/keen/explorer","homepage":"https://keen.github.io/explorer","size":14882,"stargazers_count":560,"watchers_count":560,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":38,"mirror_url":null,"open_issues_count":3,"forks":38,"open_issues":3,"watchers":560,"default_branch":"master"}},"base":{"label":"keen:master","ref":"master","sha":"c11a096b9ae7c22e36689a9f0f72c18427c58888","user":{"login":"keen","id":8461781,"avatar_url":"https://avatars.githubusercontent.com/u/8461781?v=3","gravatar_id":"","url":"https://api.github.com/users/keen","html_url":"https://github.com/keen","followers_url":"https://api.github.com/users/keen/followers","following_url":"https://api.github.com/users/keen/following{/other_user}","gists_url":"https://api.github.com/users/keen/gists{/gist_id}","starred_url":"https://api.github.com/users/keen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keen/subscriptions","organizations_url":"https://api.github.com/users/keen/orgs","repos_url":"https://api.github.com/users/keen/repos","events_url":"https://api.github.com/users/keen/events{/privacy}","received_events_url":"https://api.github.com/users/keen/received_events","type":"Organization","site_admin":false},"repo":{"id":37276906,"name":"explorer","full_name":"keen/explorer","owner":{"login":"keen","id":8461781,"avatar_url":"https://avatars.githubusercontent.com/u/8461781?v=3","gravatar_id":"","url":"https://api.github.com/users/keen","html_url":"https://github.com/keen","followers_url":"https://api.github.com/users/keen/followers","following_url":"https://api.github.com/users/keen/following{/other_user}","gists_url":"https://api.github.com/users/keen/gists{/gist_id}","starred_url":"https://api.github.com/users/keen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keen/subscriptions","organizations_url":"https://api.github.com/users/keen/orgs","repos_url":"https://api.github.com/users/keen/repos","events_url":"https://api.github.com/users/keen/events{/privacy}","received_events_url":"https://api.github.com/users/keen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keen/explorer","description":"Data Explorer by Keen IO","fork":false,"url":"https://api.github.com/repos/keen/explorer","forks_url":"https://api.github.com/repos/keen/explorer/forks","keys_url":"https://api.github.com/repos/keen/explorer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keen/explorer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keen/explorer/teams","hooks_url":"https://api.github.com/repos/keen/explorer/hooks","issue_events_url":"https://api.github.com/repos/keen/explorer/issues/events{/number}","events_url":"https://api.github.com/repos/keen/explorer/events","assignees_url":"https://api.github.com/repos/keen/explorer/assignees{/user}","branches_url":"https://api.github.com/repos/keen/explorer/branches{/branch}","tags_url":"https://api.github.com/repos/keen/explorer/tags","blobs_url":"https://api.github.com/repos/keen/explorer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keen/explorer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keen/explorer/git/refs{/sha}","trees_url":"https://api.github.com/repos/keen/explorer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keen/explorer/statuses/{sha}","languages_url":"https://api.github.com/repos/keen/explorer/languages","stargazers_url":"https://api.github.com/repos/keen/explorer/stargazers","contributors_url":"https://api.github.com/repos/keen/explorer/contributors","subscribers_url":"https://api.github.com/repos/keen/explorer/subscribers","subscription_url":"https://api.github.com/repos/keen/explorer/subscription","commits_url":"https://api.github.com/repos/keen/explorer/commits{/sha}","git_commits_url":"https://api.github.com/repos/keen/explorer/git/commits{/sha}","comments_url":"https://api.github.com/repos/keen/explorer/comments{/number}","issue_comment_url":"https://api.github.com/repos/keen/explorer/issues/comments{/number}","contents_url":"https://api.github.com/repos/keen/explorer/contents/{+path}","compare_url":"https://api.github.com/repos/keen/explorer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keen/explorer/merges","archive_url":"https://api.github.com/repos/keen/explorer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keen/explorer/downloads","issues_url":"https://api.github.com/repos/keen/explorer/issues{/number}","pulls_url":"https://api.github.com/repos/keen/explorer/pulls{/number}","milestones_url":"https://api.github.com/repos/keen/explorer/milestones{/number}","notifications_url":"https://api.github.com/repos/keen/explorer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keen/explorer/labels{/name}","releases_url":"https://api.github.com/repos/keen/explorer/releases{/id}","created_at":"2015-06-11T17:56:40Z","updated_at":"2015-11-08T17:23:32Z","pushed_at":"2015-11-09T15:16:14Z","git_url":"git://github.com/keen/explorer.git","ssh_url":"git@github.com:keen/explorer.git","clone_url":"https://github.com/keen/explorer.git","svn_url":"https://github.com/keen/explorer","homepage":"https://keen.github.io/explorer","size":14882,"stargazers_count":560,"watchers_count":560,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":38,"mirror_url":null,"open_issues_count":3,"forks":38,"open_issues":3,"watchers":560,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/keen/explorer/pulls/37"},"html":{"href":"https://github.com/keen/explorer/pull/37"},"issue":{"href":"https://api.github.com/repos/keen/explorer/issues/37"},"comments":{"href":"https://api.github.com/repos/keen/explorer/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/keen/explorer/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/keen/explorer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/keen/explorer/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/keen/explorer/statuses/5c60571ed3f0947dea11804a8ce8f1e47fba9955"}}}}