{"action":"created","comment":{"url":"https://api.github.com/repos/rwahs/research-frontend/pulls/comments/70023299","id":70023299,"diff_hunk":"@@ -0,0 +1,90 @@\n+// Based on http://kindohm.github.io/knockout-query-builder/js/group.js\n+(function () {\n+    'use strict';\n+\n+    define(\n+        [\n+            'lodash',\n+            'knockout',\n+            'models/query/Condition'\n+        ],\n+        function (_, ko, Condition) {\n+            var Group;\n+\n+            Group = function (queryBuilder, parentGroup) {\n+                this.children = ko.observableArray();\n+                this.selectedOperator = ko.observable();\n+\n+                this.operators = ko.pureComputed(function () {\n+                    return [\n+                        {\n+                            label: 'and',\n+                            value: 'AND'\n+                        },\n+                        {\n+                            label: 'or',\n+                            value: 'OR'\n+                        }\n+                    ];\n+                });\n+\n+                this.depth = ko.pureComputed(function () {\n+                    return parentGroup ? 1 + parentGroup.depth() : 0;\n+                });\n+\n+                this.allowChildren = ko.pureComputed(function () {\n+                    return this.depth() + 1 < queryBuilder.maxDepth();\n+                }.bind(this));\n+\n+                this.query = ko.pureComputed(function () {\n+                    return {\n+                        operator: this.selectedOperator(),\n+                        children: _(this.children()).invokeMap('query').filter().value()","path":"public/app/models/query/Group.js","position":42,"original_position":42,"commit_id":"a10e7349fbd73c24682afcd5d165ad876b2d6f2f","original_commit_id":"a10e7349fbd73c24682afcd5d165ad876b2d6f2f","user":{"login":"leftclickben","id":94266,"avatar_url":"https://avatars.githubusercontent.com/u/94266?v=3","gravatar_id":"","url":"https://api.github.com/users/leftclickben","html_url":"https://github.com/leftclickben","followers_url":"https://api.github.com/users/leftclickben/followers","following_url":"https://api.github.com/users/leftclickben/following{/other_user}","gists_url":"https://api.github.com/users/leftclickben/gists{/gist_id}","starred_url":"https://api.github.com/users/leftclickben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leftclickben/subscriptions","organizations_url":"https://api.github.com/users/leftclickben/orgs","repos_url":"https://api.github.com/users/leftclickben/repos","events_url":"https://api.github.com/users/leftclickben/events{/privacy}","received_events_url":"https://api.github.com/users/leftclickben/received_events","type":"User","site_admin":false},"body":"The `invokeMap` function calls the given function on each of the elements, i.e. it calls `query` on each of the elements of the `children` array.  Each of those elements is either a `Condition`, which is a leaf node, or a `Group`, which means this is `Group.query` calling itself recursively.","created_at":"2016-07-08T04:11:42Z","updated_at":"2016-07-08T04:11:42Z","html_url":"https://github.com/rwahs/research-frontend/pull/55#discussion_r70023299","pull_request_url":"https://api.github.com/repos/rwahs/research-frontend/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/rwahs/research-frontend/pulls/comments/70023299"},"html":{"href":"https://github.com/rwahs/research-frontend/pull/55#discussion_r70023299"},"pull_request":{"href":"https://api.github.com/repos/rwahs/research-frontend/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/rwahs/research-frontend/pulls/55","id":76650160,"html_url":"https://github.com/rwahs/research-frontend/pull/55","diff_url":"https://github.com/rwahs/research-frontend/pull/55.diff","patch_url":"https://github.com/rwahs/research-frontend/pull/55.patch","issue_url":"https://api.github.com/repos/rwahs/research-frontend/issues/55","number":55,"state":"open","locked":false,"title":"RWAHS-391 Advanced search","user":{"login":"leftclickben","id":94266,"avatar_url":"https://avatars.githubusercontent.com/u/94266?v=3","gravatar_id":"","url":"https://api.github.com/users/leftclickben","html_url":"https://github.com/leftclickben","followers_url":"https://api.github.com/users/leftclickben/followers","following_url":"https://api.github.com/users/leftclickben/following{/other_user}","gists_url":"https://api.github.com/users/leftclickben/gists{/gist_id}","starred_url":"https://api.github.com/users/leftclickben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leftclickben/subscriptions","organizations_url":"https://api.github.com/users/leftclickben/orgs","repos_url":"https://api.github.com/users/leftclickben/repos","events_url":"https://api.github.com/users/leftclickben/events{/privacy}","received_events_url":"https://api.github.com/users/leftclickben/received_events","type":"User","site_admin":false},"body":"The long-awaited Advanced Search functionality.","created_at":"2016-07-07T19:17:30Z","updated_at":"2016-07-08T04:11:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"feb2b8c6f37fc7f0753b54f20d119d885ffe2126","assignee":{"login":"mostro20","id":4536010,"avatar_url":"https://avatars.githubusercontent.com/u/4536010?v=3","gravatar_id":"","url":"https://api.github.com/users/mostro20","html_url":"https://github.com/mostro20","followers_url":"https://api.github.com/users/mostro20/followers","following_url":"https://api.github.com/users/mostro20/following{/other_user}","gists_url":"https://api.github.com/users/mostro20/gists{/gist_id}","starred_url":"https://api.github.com/users/mostro20/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mostro20/subscriptions","organizations_url":"https://api.github.com/users/mostro20/orgs","repos_url":"https://api.github.com/users/mostro20/repos","events_url":"https://api.github.com/users/mostro20/events{/privacy}","received_events_url":"https://api.github.com/users/mostro20/received_events","type":"User","site_admin":false},"assignees":[{"login":"mostro20","id":4536010,"avatar_url":"https://avatars.githubusercontent.com/u/4536010?v=3","gravatar_id":"","url":"https://api.github.com/users/mostro20","html_url":"https://github.com/mostro20","followers_url":"https://api.github.com/users/mostro20/followers","following_url":"https://api.github.com/users/mostro20/following{/other_user}","gists_url":"https://api.github.com/users/mostro20/gists{/gist_id}","starred_url":"https://api.github.com/users/mostro20/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mostro20/subscriptions","organizations_url":"https://api.github.com/users/mostro20/orgs","repos_url":"https://api.github.com/users/mostro20/repos","events_url":"https://api.github.com/users/mostro20/events{/privacy}","received_events_url":"https://api.github.com/users/mostro20/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/rwahs/research-frontend/pulls/55/commits","review_comments_url":"https://api.github.com/repos/rwahs/research-frontend/pulls/55/comments","review_comment_url":"https://api.github.com/repos/rwahs/research-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rwahs/research-frontend/issues/55/comments","statuses_url":"https://api.github.com/repos/rwahs/research-frontend/statuses/a10e7349fbd73c24682afcd5d165ad876b2d6f2f","head":{"label":"leftclickben:RWAHS-391/AdvancedSearch","ref":"RWAHS-391/AdvancedSearch","sha":"a10e7349fbd73c24682afcd5d165ad876b2d6f2f","user":{"login":"leftclickben","id":94266,"avatar_url":"https://avatars.githubusercontent.com/u/94266?v=3","gravatar_id":"","url":"https://api.github.com/users/leftclickben","html_url":"https://github.com/leftclickben","followers_url":"https://api.github.com/users/leftclickben/followers","following_url":"https://api.github.com/users/leftclickben/following{/other_user}","gists_url":"https://api.github.com/users/leftclickben/gists{/gist_id}","starred_url":"https://api.github.com/users/leftclickben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leftclickben/subscriptions","organizations_url":"https://api.github.com/users/leftclickben/orgs","repos_url":"https://api.github.com/users/leftclickben/repos","events_url":"https://api.github.com/users/leftclickben/events{/privacy}","received_events_url":"https://api.github.com/users/leftclickben/received_events","type":"User","site_admin":false},"repo":{"id":59711254,"name":"research-frontend","full_name":"leftclickben/research-frontend","owner":{"login":"leftclickben","id":94266,"avatar_url":"https://avatars.githubusercontent.com/u/94266?v=3","gravatar_id":"","url":"https://api.github.com/users/leftclickben","html_url":"https://github.com/leftclickben","followers_url":"https://api.github.com/users/leftclickben/followers","following_url":"https://api.github.com/users/leftclickben/following{/other_user}","gists_url":"https://api.github.com/users/leftclickben/gists{/gist_id}","starred_url":"https://api.github.com/users/leftclickben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leftclickben/subscriptions","organizations_url":"https://api.github.com/users/leftclickben/orgs","repos_url":"https://api.github.com/users/leftclickben/repos","events_url":"https://api.github.com/users/leftclickben/events{/privacy}","received_events_url":"https://api.github.com/users/leftclickben/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/leftclickben/research-frontend","description":"Public research frontend SPA for CA","fork":true,"url":"https://api.github.com/repos/leftclickben/research-frontend","forks_url":"https://api.github.com/repos/leftclickben/research-frontend/forks","keys_url":"https://api.github.com/repos/leftclickben/research-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leftclickben/research-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leftclickben/research-frontend/teams","hooks_url":"https://api.github.com/repos/leftclickben/research-frontend/hooks","issue_events_url":"https://api.github.com/repos/leftclickben/research-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/leftclickben/research-frontend/events","assignees_url":"https://api.github.com/repos/leftclickben/research-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/leftclickben/research-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/leftclickben/research-frontend/tags","blobs_url":"https://api.github.com/repos/leftclickben/research-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leftclickben/research-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leftclickben/research-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/leftclickben/research-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leftclickben/research-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/leftclickben/research-frontend/languages","stargazers_url":"https://api.github.com/repos/leftclickben/research-frontend/stargazers","contributors_url":"https://api.github.com/repos/leftclickben/research-frontend/contributors","subscribers_url":"https://api.github.com/repos/leftclickben/research-frontend/subscribers","subscription_url":"https://api.github.com/repos/leftclickben/research-frontend/subscription","commits_url":"https://api.github.com/repos/leftclickben/research-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/leftclickben/research-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/leftclickben/research-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/leftclickben/research-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/leftclickben/research-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/leftclickben/research-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leftclickben/research-frontend/merges","archive_url":"https://api.github.com/repos/leftclickben/research-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leftclickben/research-frontend/downloads","issues_url":"https://api.github.com/repos/leftclickben/research-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/leftclickben/research-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/leftclickben/research-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/leftclickben/research-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leftclickben/research-frontend/labels{/name}","releases_url":"https://api.github.com/repos/leftclickben/research-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/leftclickben/research-frontend/deployments","created_at":"2016-05-26T01:53:29Z","updated_at":"2016-05-30T04:21:40Z","pushed_at":"2016-07-07T19:14:40Z","git_url":"git://github.com/leftclickben/research-frontend.git","ssh_url":"git@github.com:leftclickben/research-frontend.git","clone_url":"https://github.com/leftclickben/research-frontend.git","svn_url":"https://github.com/leftclickben/research-frontend","homepage":null,"size":556,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rwahs:master","ref":"master","sha":"604a79fa7fdff205d3e33a3b42a643fd20858dfc","user":{"login":"rwahs","id":16794641,"avatar_url":"https://avatars.githubusercontent.com/u/16794641?v=3","gravatar_id":"","url":"https://api.github.com/users/rwahs","html_url":"https://github.com/rwahs","followers_url":"https://api.github.com/users/rwahs/followers","following_url":"https://api.github.com/users/rwahs/following{/other_user}","gists_url":"https://api.github.com/users/rwahs/gists{/gist_id}","starred_url":"https://api.github.com/users/rwahs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwahs/subscriptions","organizations_url":"https://api.github.com/users/rwahs/orgs","repos_url":"https://api.github.com/users/rwahs/repos","events_url":"https://api.github.com/users/rwahs/events{/privacy}","received_events_url":"https://api.github.com/users/rwahs/received_events","type":"Organization","site_admin":false},"repo":{"id":59711220,"name":"research-frontend","full_name":"rwahs/research-frontend","owner":{"login":"rwahs","id":16794641,"avatar_url":"https://avatars.githubusercontent.com/u/16794641?v=3","gravatar_id":"","url":"https://api.github.com/users/rwahs","html_url":"https://github.com/rwahs","followers_url":"https://api.github.com/users/rwahs/followers","following_url":"https://api.github.com/users/rwahs/following{/other_user}","gists_url":"https://api.github.com/users/rwahs/gists{/gist_id}","starred_url":"https://api.github.com/users/rwahs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwahs/subscriptions","organizations_url":"https://api.github.com/users/rwahs/orgs","repos_url":"https://api.github.com/users/rwahs/repos","events_url":"https://api.github.com/users/rwahs/events{/privacy}","received_events_url":"https://api.github.com/users/rwahs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rwahs/research-frontend","description":"Public research frontend SPA for CA","fork":false,"url":"https://api.github.com/repos/rwahs/research-frontend","forks_url":"https://api.github.com/repos/rwahs/research-frontend/forks","keys_url":"https://api.github.com/repos/rwahs/research-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rwahs/research-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rwahs/research-frontend/teams","hooks_url":"https://api.github.com/repos/rwahs/research-frontend/hooks","issue_events_url":"https://api.github.com/repos/rwahs/research-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/rwahs/research-frontend/events","assignees_url":"https://api.github.com/repos/rwahs/research-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/rwahs/research-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/rwahs/research-frontend/tags","blobs_url":"https://api.github.com/repos/rwahs/research-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rwahs/research-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rwahs/research-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/rwahs/research-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rwahs/research-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/rwahs/research-frontend/languages","stargazers_url":"https://api.github.com/repos/rwahs/research-frontend/stargazers","contributors_url":"https://api.github.com/repos/rwahs/research-frontend/contributors","subscribers_url":"https://api.github.com/repos/rwahs/research-frontend/subscribers","subscription_url":"https://api.github.com/repos/rwahs/research-frontend/subscription","commits_url":"https://api.github.com/repos/rwahs/research-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/rwahs/research-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/rwahs/research-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/rwahs/research-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/rwahs/research-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/rwahs/research-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rwahs/research-frontend/merges","archive_url":"https://api.github.com/repos/rwahs/research-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rwahs/research-frontend/downloads","issues_url":"https://api.github.com/repos/rwahs/research-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/rwahs/research-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/rwahs/research-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/rwahs/research-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rwahs/research-frontend/labels{/name}","releases_url":"https://api.github.com/repos/rwahs/research-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/rwahs/research-frontend/deployments","created_at":"2016-05-26T01:52:57Z","updated_at":"2016-05-30T04:18:29Z","pushed_at":"2016-07-07T19:17:30Z","git_url":"git://github.com/rwahs/research-frontend.git","ssh_url":"git@github.com:rwahs/research-frontend.git","clone_url":"https://github.com/rwahs/research-frontend.git","svn_url":"https://github.com/rwahs/research-frontend","homepage":null,"size":503,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rwahs/research-frontend/pulls/55"},"html":{"href":"https://github.com/rwahs/research-frontend/pull/55"},"issue":{"href":"https://api.github.com/repos/rwahs/research-frontend/issues/55"},"comments":{"href":"https://api.github.com/repos/rwahs/research-frontend/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/rwahs/research-frontend/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/rwahs/research-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rwahs/research-frontend/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/rwahs/research-frontend/statuses/a10e7349fbd73c24682afcd5d165ad876b2d6f2f"}}}}
{"actor":{"display_login":"leftclickben"}}