GitHub PullRequestReviewCommentEvent at 2014-09-04 20:21:16
Repository: candlepin
Actor: cakofony
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/candlepin/candlepin/pulls/comments/17139451","id":17139451,"diff_hunk":"@@ -102,4 +103,73 @@ public String getCollectionName() {\n             query, project, sort, group, postResultFilter /* skip, limit */));\n         return output.results();\n     }\n+\n+    public Iterable<DBObject> getComplianceForTimespan(Date startDate,\n+            Date endDate, List<String> consumerIds, List<String> owners) {\n+        // Anything added to the main query will filter the initial result set. This should\n+        // include anything that helps narrow down the query of the latest snapshots reported\n+        // and consists of properties that do not change across snapshots.\n+        BasicDBObjectBuilder queryBuilder = BasicDBObjectBuilder.start();\n+\n+\n+        if (owners != null && !owners.isEmpty()) {\n+            queryBuilder.add(\"consumer.owner.key\", new BasicDBObject(\"$in\", owners));\n+        }\n+\n+        BasicDBObjectBuilder dateQueryBuilder = BasicDBObjectBuilder.start();\n+        if (startDate != null) {\n+            // Use greater than (not equals) because we've already looked up status for <= the start date\n+            // $gte will open the door for duplicates\n+            dateQueryBuilder.add(\"$gt\", startDate);\n+        }\n+        if (endDate != null) {\n+            dateQueryBuilder.add(\"$lte\", endDate);\n+        }\n+        if (startDate != null || endDate != null) {\n+            queryBuilder.add(\"status.date\", dateQueryBuilder.get());\n+        }\n+\n+        // Build the projections\n+        BasicDBObject projections = new BasicDBObject();\n+        projections.put(\"consumer\", 1);\n+        projections.put(\"status\", 1);\n+        projections.put(\"_id\", 0);\n+        BasicDBObject project = new BasicDBObject(\"$project\", projections);\n+\n+        DBObject query = new BasicDBObject(\"$match\", queryBuilder.get());\n+        DBObject sort = new BasicDBObject(\"$sort\", new BasicDBObject(\"status.date\", 1));\n+\n+        // NOTE: The order of the aggregate actions is very important.\n+        AggregationOutput output = collection.aggregate(Arrays.asList(\n+            query, project, sort/*, group, postResultFilter, skip, limit */));\n+        return output.results();","path":"gutterball/src/main/java/org/candlepin/gutterball/curator/ComplianceDataCurator.java","position":null,"original_position":51,"commit_id":"2de07f7101a7d1495ffecf95378f429eb9a5ac80","original_commit_id":"9f025b396fb8f360f87a549fce5d75dbad843fbe","user":{"login":"cakofony","id":3854321,"avatar_url":"https://avatars.githubusercontent.com/u/3854321?v=2","gravatar_id":"ab111ab05cd1e4f33434d9f76bb0c96d","url":"https://api.github.com/users/cakofony","html_url":"https://github.com/cakofony","followers_url":"https://api.github.com/users/cakofony/followers","following_url":"https://api.github.com/users/cakofony/following{/other_user}","gists_url":"https://api.github.com/users/cakofony/gists{/gist_id}","starred_url":"https://api.github.com/users/cakofony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakofony/subscriptions","organizations_url":"https://api.github.com/users/cakofony/orgs","repos_url":"https://api.github.com/users/cakofony/repos","events_url":"https://api.github.com/users/cakofony/events{/privacy}","received_events_url":"https://api.github.com/users/cakofony/received_events","type":"User","site_admin":false},"body":"I just realized that because we're using find rather than aggregate, I can write a DBDecoder/Factory that transforms facts to correct json!","created_at":"2014-09-04T20:21:16Z","updated_at":"2014-09-04T20:21:16Z","html_url":"https://github.com/candlepin/candlepin/pull/708#discussion_r17139451","pull_request_url":"https://api.github.com/repos/candlepin/candlepin/pulls/708","_links":{"self":{"href":"https://api.github.com/repos/candlepin/candlepin/pulls/comments/17139451"},"html":{"href":"https://github.com/candlepin/candlepin/pull/708#discussion_r17139451"},"pull_request":{"href":"https://api.github.com/repos/candlepin/candlepin/pulls/708"}}},"pull_request":{"url":"https://api.github.com/repos/candlepin/candlepin/pulls/708","id":20627947,"html_url":"https://github.com/candlepin/candlepin/pull/708","diff_url":"https://github.com/candlepin/candlepin/pull/708.diff","patch_url":"https://github.com/candlepin/candlepin/pull/708.patch","issue_url":"https://api.github.com/repos/candlepin/candlepin/issues/708","number":708,"state":"open","locked":false,"title":"Ckozak/consumer trend report","user":{"login":"cakofony","id":3854321,"avatar_url":"https://avatars.githubusercontent.com/u/3854321?v=2","gravatar_id":"ab111ab05cd1e4f33434d9f76bb0c96d","url":"https://api.github.com/users/cakofony","html_url":"https://github.com/cakofony","followers_url":"https://api.github.com/users/cakofony/followers","following_url":"https://api.github.com/users/cakofony/following{/other_user}","gists_url":"https://api.github.com/users/cakofony/gists{/gist_id}","starred_url":"https://api.github.com/users/cakofony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakofony/subscriptions","organizations_url":"https://api.github.com/users/cakofony/orgs","repos_url":"https://api.github.com/users/cakofony/repos","events_url":"https://api.github.com/users/cakofony/events{/privacy}","received_events_url":"https://api.github.com/users/cakofony/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-09-02T17:36:23Z","updated_at":"2014-09-04T20:21:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f5be92c4e887e321149a5838bab3dd73a31d97d","assignee":{"login":"mstead","id":218800,"avatar_url":"https://avatars.githubusercontent.com/u/218800?v=2","gravatar_id":"cff2de4d58af775ba0a07a5332b57889","url":"https://api.github.com/users/mstead","html_url":"https://github.com/mstead","followers_url":"https://api.github.com/users/mstead/followers","following_url":"https://api.github.com/users/mstead/following{/other_user}","gists_url":"https://api.github.com/users/mstead/gists{/gist_id}","starred_url":"https://api.github.com/users/mstead/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mstead/subscriptions","organizations_url":"https://api.github.com/users/mstead/orgs","repos_url":"https://api.github.com/users/mstead/repos","events_url":"https://api.github.com/users/mstead/events{/privacy}","received_events_url":"https://api.github.com/users/mstead/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/candlepin/candlepin/pulls/708/commits","review_comments_url":"https://api.github.com/repos/candlepin/candlepin/pulls/708/comments","review_comment_url":"https://api.github.com/repos/candlepin/candlepin/pulls/comments/{number}","comments_url":"https://api.github.com/repos/candlepin/candlepin/issues/708/comments","statuses_url":"https://api.github.com/repos/candlepin/candlepin/statuses/2de07f7101a7d1495ffecf95378f429eb9a5ac80","head":{"label":"candlepin:ckozak/consumer_trend_report","ref":"ckozak/consumer_trend_report","sha":"2de07f7101a7d1495ffecf95378f429eb9a5ac80","user":{"login":"candlepin","id":1749632,"avatar_url":"https://avatars.githubusercontent.com/u/1749632?v=2","gravatar_id":"8210547cb1a421e2100459c7690915c2","url":"https://api.github.com/users/candlepin","html_url":"https://github.com/candlepin","followers_url":"https://api.github.com/users/candlepin/followers","following_url":"https://api.github.com/users/candlepin/following{/other_user}","gists_url":"https://api.github.com/users/candlepin/gists{/gist_id}","starred_url":"https://api.github.com/users/candlepin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candlepin/subscriptions","organizations_url":"https://api.github.com/users/candlepin/orgs","repos_url":"https://api.github.com/users/candlepin/repos","events_url":"https://api.github.com/users/candlepin/events{/privacy}","received_events_url":"https://api.github.com/users/candlepin/received_events","type":"Organization","site_admin":false},"repo":{"id":4586516,"name":"candlepin","full_name":"candlepin/candlepin","owner":{"login":"candlepin","id":1749632,"avatar_url":"https://avatars.githubusercontent.com/u/1749632?v=2","gravatar_id":"8210547cb1a421e2100459c7690915c2","url":"https://api.github.com/users/candlepin","html_url":"https://github.com/candlepin","followers_url":"https://api.github.com/users/candlepin/followers","following_url":"https://api.github.com/users/candlepin/following{/other_user}","gists_url":"https://api.github.com/users/candlepin/gists{/gist_id}","starred_url":"https://api.github.com/users/candlepin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candlepin/subscriptions","organizations_url":"https://api.github.com/users/candlepin/orgs","repos_url":"https://api.github.com/users/candlepin/repos","events_url":"https://api.github.com/users/candlepin/events{/privacy}","received_events_url":"https://api.github.com/users/candlepin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/candlepin/candlepin","description":"The Candlepin entitlement engine","fork":false,"url":"https://api.github.com/repos/candlepin/candlepin","forks_url":"https://api.github.com/repos/candlepin/candlepin/forks","keys_url":"https://api.github.com/repos/candlepin/candlepin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/candlepin/candlepin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/candlepin/candlepin/teams","hooks_url":"https://api.github.com/repos/candlepin/candlepin/hooks","issue_events_url":"https://api.github.com/repos/candlepin/candlepin/issues/events{/number}","events_url":"https://api.github.com/repos/candlepin/candlepin/events","assignees_url":"https://api.github.com/repos/candlepin/candlepin/assignees{/user}","branches_url":"https://api.github.com/repos/candlepin/candlepin/branches{/branch}","tags_url":"https://api.github.com/repos/candlepin/candlepin/tags","blobs_url":"https://api.github.com/repos/candlepin/candlepin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/candlepin/candlepin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/candlepin/candlepin/git/refs{/sha}","trees_url":"https://api.github.com/repos/candlepin/candlepin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/candlepin/candlepin/statuses/{sha}","languages_url":"https://api.github.com/repos/candlepin/candlepin/languages","stargazers_url":"https://api.github.com/repos/candlepin/candlepin/stargazers","contributors_url":"https://api.github.com/repos/candlepin/candlepin/contributors","subscribers_url":"https://api.github.com/repos/candlepin/candlepin/subscribers","subscription_url":"https://api.github.com/repos/candlepin/candlepin/subscription","commits_url":"https://api.github.com/repos/candlepin/candlepin/commits{/sha}","git_commits_url":"https://api.github.com/repos/candlepin/candlepin/git/commits{/sha}","comments_url":"https://api.github.com/repos/candlepin/candlepin/comments{/number}","issue_comment_url":"https://api.github.com/repos/candlepin/candlepin/issues/comments/{number}","contents_url":"https://api.github.com/repos/candlepin/candlepin/contents/{+path}","compare_url":"https://api.github.com/repos/candlepin/candlepin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/candlepin/candlepin/merges","archive_url":"https://api.github.com/repos/candlepin/candlepin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/candlepin/candlepin/downloads","issues_url":"https://api.github.com/repos/candlepin/candlepin/issues{/number}","pulls_url":"https://api.github.com/repos/candlepin/candlepin/pulls{/number}","milestones_url":"https://api.github.com/repos/candlepin/candlepin/milestones{/number}","notifications_url":"https://api.github.com/repos/candlepin/candlepin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/candlepin/candlepin/labels{/name}","releases_url":"https://api.github.com/repos/candlepin/candlepin/releases{/id}","created_at":"2012-06-07T14:58:35Z","updated_at":"2014-09-02T14:04:04Z","pushed_at":"2014-09-04T20:21:09Z","git_url":"git://github.com/candlepin/candlepin.git","ssh_url":"git@github.com:candlepin/candlepin.git","clone_url":"https://github.com/candlepin/candlepin.git","svn_url":"https://github.com/candlepin/candlepin","homepage":"http://candlepinproject.org","size":53702,"stargazers_count":18,"watchers_count":18,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":17,"mirror_url":null,"open_issues_count":5,"forks":17,"open_issues":5,"watchers":18,"default_branch":"master"}},"base":{"label":"candlepin:master","ref":"master","sha":"f896376989fc03460a2a76ef0d687de160d23e26","user":{"login":"candlepin","id":1749632,"avatar_url":"https://avatars.githubusercontent.com/u/1749632?v=2","gravatar_id":"8210547cb1a421e2100459c7690915c2","url":"https://api.github.com/users/candlepin","html_url":"https://github.com/candlepin","followers_url":"https://api.github.com/users/candlepin/followers","following_url":"https://api.github.com/users/candlepin/following{/other_user}","gists_url":"https://api.github.com/users/candlepin/gists{/gist_id}","starred_url":"https://api.github.com/users/candlepin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candlepin/subscriptions","organizations_url":"https://api.github.com/users/candlepin/orgs","repos_url":"https://api.github.com/users/candlepin/repos","events_url":"https://api.github.com/users/candlepin/events{/privacy}","received_events_url":"https://api.github.com/users/candlepin/received_events","type":"Organization","site_admin":false},"repo":{"id":4586516,"name":"candlepin","full_name":"candlepin/candlepin","owner":{"login":"candlepin","id":1749632,"avatar_url":"https://avatars.githubusercontent.com/u/1749632?v=2","gravatar_id":"8210547cb1a421e2100459c7690915c2","url":"https://api.github.com/users/candlepin","html_url":"https://github.com/candlepin","followers_url":"https://api.github.com/users/candlepin/followers","following_url":"https://api.github.com/users/candlepin/following{/other_user}","gists_url":"https://api.github.com/users/candlepin/gists{/gist_id}","starred_url":"https://api.github.com/users/candlepin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candlepin/subscriptions","organizations_url":"https://api.github.com/users/candlepin/orgs","repos_url":"https://api.github.com/users/candlepin/repos","events_url":"https://api.github.com/users/candlepin/events{/privacy}","received_events_url":"https://api.github.com/users/candlepin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/candlepin/candlepin","description":"The Candlepin entitlement engine","fork":false,"url":"https://api.github.com/repos/candlepin/candlepin","forks_url":"https://api.github.com/repos/candlepin/candlepin/forks","keys_url":"https://api.github.com/repos/candlepin/candlepin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/candlepin/candlepin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/candlepin/candlepin/teams","hooks_url":"https://api.github.com/repos/candlepin/candlepin/hooks","issue_events_url":"https://api.github.com/repos/candlepin/candlepin/issues/events{/number}","events_url":"https://api.github.com/repos/candlepin/candlepin/events","assignees_url":"https://api.github.com/repos/candlepin/candlepin/assignees{/user}","branches_url":"https://api.github.com/repos/candlepin/candlepin/branches{/branch}","tags_url":"https://api.github.com/repos/candlepin/candlepin/tags","blobs_url":"https://api.github.com/repos/candlepin/candlepin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/candlepin/candlepin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/candlepin/candlepin/git/refs{/sha}","trees_url":"https://api.github.com/repos/candlepin/candlepin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/candlepin/candlepin/statuses/{sha}","languages_url":"https://api.github.com/repos/candlepin/candlepin/languages","stargazers_url":"https://api.github.com/repos/candlepin/candlepin/stargazers","contributors_url":"https://api.github.com/repos/candlepin/candlepin/contributors","subscribers_url":"https://api.github.com/repos/candlepin/candlepin/subscribers","subscription_url":"https://api.github.com/repos/candlepin/candlepin/subscription","commits_url":"https://api.github.com/repos/candlepin/candlepin/commits{/sha}","git_commits_url":"https://api.github.com/repos/candlepin/candlepin/git/commits{/sha}","comments_url":"https://api.github.com/repos/candlepin/candlepin/comments{/number}","issue_comment_url":"https://api.github.com/repos/candlepin/candlepin/issues/comments/{number}","contents_url":"https://api.github.com/repos/candlepin/candlepin/contents/{+path}","compare_url":"https://api.github.com/repos/candlepin/candlepin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/candlepin/candlepin/merges","archive_url":"https://api.github.com/repos/candlepin/candlepin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/candlepin/candlepin/downloads","issues_url":"https://api.github.com/repos/candlepin/candlepin/issues{/number}","pulls_url":"https://api.github.com/repos/candlepin/candlepin/pulls{/number}","milestones_url":"https://api.github.com/repos/candlepin/candlepin/milestones{/number}","notifications_url":"https://api.github.com/repos/candlepin/candlepin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/candlepin/candlepin/labels{/name}","releases_url":"https://api.github.com/repos/candlepin/candlepin/releases{/id}","created_at":"2012-06-07T14:58:35Z","updated_at":"2014-09-02T14:04:04Z","pushed_at":"2014-09-04T20:21:09Z","git_url":"git://github.com/candlepin/candlepin.git","ssh_url":"git@github.com:candlepin/candlepin.git","clone_url":"https://github.com/candlepin/candlepin.git","svn_url":"https://github.com/candlepin/candlepin","homepage":"http://candlepinproject.org","size":53702,"stargazers_count":18,"watchers_count":18,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":17,"mirror_url":null,"open_issues_count":5,"forks":17,"open_issues":5,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/candlepin/candlepin/pulls/708"},"html":{"href":"https://github.com/candlepin/candlepin/pull/708"},"issue":{"href":"https://api.github.com/repos/candlepin/candlepin/issues/708"},"comments":{"href":"https://api.github.com/repos/candlepin/candlepin/issues/708/comments"},"review_comments":{"href":"https://api.github.com/repos/candlepin/candlepin/pulls/708/comments"},"review_comment":{"href":"https://api.github.com/repos/candlepin/candlepin/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/candlepin/candlepin/pulls/708/commits"},"statuses":{"href":"https://api.github.com/repos/candlepin/candlepin/statuses/2de07f7101a7d1495ffecf95378f429eb9a5ac80"}}}}