{"action":"created","comment":{"url":"https://api.github.com/repos/olimart/queenbee/pulls/comments/38065507","id":38065507,"diff_hunk":"@@ -0,0 +1,129 @@\n+module Metrics\n+\n+  # Metrics::Base.new(Application.first.orders)\n+  class Base\n+    def initialize(orders)\n+      @orders     = orders\n+      today       = Date.today\n+      @today      = group_orders(orders, today, today)\n+      @yesterday  = group_orders(orders, today-1, today-1)\n+\n+      @this_week  = group_orders(orders, today.beginning_of_week, today)\n+      @last_week  = group_orders(orders, today.beginning_of_week-7, today.end_of_week-7)\n+\n+      @this_month = group_orders(orders, today.beginning_of_month, today)\n+      @last_month = group_orders(orders, today.beginning_of_month-1.month, today.end_of_month-1.month)\n+\n+      @this_year  = group_orders(orders, today.beginning_of_year, today)\n+      @last_year  = group_orders(orders, today.beginning_of_year-1.year, today.end_of_year-1.year)\n+\n+      @total      = orders\n+    end\n+\n+    def orders_count\n+      today      = @today.length\n+      yesterday  = @yesterday.length\n+      this_week  = @this_week.length\n+      last_week  = @last_week.length\n+      this_month = @this_month.length\n+      last_month = @last_month.length\n+      this_year  = @this_year.length","path":"app/services/metrics/base.rb","position":30,"original_position":30,"commit_id":"bbd81211851ad7ce00393ba3a7817beb0633d749","original_commit_id":"bbd81211851ad7ce00393ba3a7817beb0633d749","user":{"login":"codeguardci","id":9791874,"avatar_url":"https://avatars.githubusercontent.com/u/9791874?v=3","gravatar_id":"","url":"https://api.github.com/users/codeguardci","html_url":"https://github.com/codeguardci","followers_url":"https://api.github.com/users/codeguardci/followers","following_url":"https://api.github.com/users/codeguardci/following{/other_user}","gists_url":"https://api.github.com/users/codeguardci/gists{/gist_id}","starred_url":"https://api.github.com/users/codeguardci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeguardci/subscriptions","organizations_url":"https://api.github.com/users/codeguardci/orgs","repos_url":"https://api.github.com/users/codeguardci/repos","events_url":"https://api.github.com/users/codeguardci/events{/privacy}","received_events_url":"https://api.github.com/users/codeguardci/received_events","type":"User","site_admin":false},"body":"Unnecessary spacing detected.","created_at":"2015-08-27T06:23:55Z","updated_at":"2015-08-27T06:23:55Z","html_url":"https://github.com/olimart/queenbee/pull/2#discussion_r38065507","pull_request_url":"https://api.github.com/repos/olimart/queenbee/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/olimart/queenbee/pulls/comments/38065507"},"html":{"href":"https://github.com/olimart/queenbee/pull/2#discussion_r38065507"},"pull_request":{"href":"https://api.github.com/repos/olimart/queenbee/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/olimart/queenbee/pulls/2","id":43483149,"html_url":"https://github.com/olimart/queenbee/pull/2","diff_url":"https://github.com/olimart/queenbee/pull/2.diff","patch_url":"https://github.com/olimart/queenbee/pull/2.patch","issue_url":"https://api.github.com/repos/olimart/queenbee/issues/2","number":2,"state":"open","locked":false,"title":"Metrics","user":{"login":"olimart","id":547754,"avatar_url":"https://avatars.githubusercontent.com/u/547754?v=3","gravatar_id":"","url":"https://api.github.com/users/olimart","html_url":"https://github.com/olimart","followers_url":"https://api.github.com/users/olimart/followers","following_url":"https://api.github.com/users/olimart/following{/other_user}","gists_url":"https://api.github.com/users/olimart/gists{/gist_id}","starred_url":"https://api.github.com/users/olimart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olimart/subscriptions","organizations_url":"https://api.github.com/users/olimart/orgs","repos_url":"https://api.github.com/users/olimart/repos","events_url":"https://api.github.com/users/olimart/events{/privacy}","received_events_url":"https://api.github.com/users/olimart/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-27T06:23:41Z","updated_at":"2015-08-27T06:23:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6806a023f234ac9c057f53d644c96aa72c1ebb04","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/olimart/queenbee/pulls/2/commits","review_comments_url":"https://api.github.com/repos/olimart/queenbee/pulls/2/comments","review_comment_url":"https://api.github.com/repos/olimart/queenbee/pulls/comments{/number}","comments_url":"https://api.github.com/repos/olimart/queenbee/issues/2/comments","statuses_url":"https://api.github.com/repos/olimart/queenbee/statuses/bbd81211851ad7ce00393ba3a7817beb0633d749","head":{"label":"olimart:metrics","ref":"metrics","sha":"bbd81211851ad7ce00393ba3a7817beb0633d749","user":{"login":"olimart","id":547754,"avatar_url":"https://avatars.githubusercontent.com/u/547754?v=3","gravatar_id":"","url":"https://api.github.com/users/olimart","html_url":"https://github.com/olimart","followers_url":"https://api.github.com/users/olimart/followers","following_url":"https://api.github.com/users/olimart/following{/other_user}","gists_url":"https://api.github.com/users/olimart/gists{/gist_id}","starred_url":"https://api.github.com/users/olimart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olimart/subscriptions","organizations_url":"https://api.github.com/users/olimart/orgs","repos_url":"https://api.github.com/users/olimart/repos","events_url":"https://api.github.com/users/olimart/events{/privacy}","received_events_url":"https://api.github.com/users/olimart/received_events","type":"User","site_admin":false},"repo":{"id":18127043,"name":"queenbee","full_name":"olimart/queenbee","owner":{"login":"olimart","id":547754,"avatar_url":"https://avatars.githubusercontent.com/u/547754?v=3","gravatar_id":"","url":"https://api.github.com/users/olimart","html_url":"https://github.com/olimart","followers_url":"https://api.github.com/users/olimart/followers","following_url":"https://api.github.com/users/olimart/following{/other_user}","gists_url":"https://api.github.com/users/olimart/gists{/gist_id}","starred_url":"https://api.github.com/users/olimart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olimart/subscriptions","organizations_url":"https://api.github.com/users/olimart/orgs","repos_url":"https://api.github.com/users/olimart/repos","events_url":"https://api.github.com/users/olimart/events{/privacy}","received_events_url":"https://api.github.com/users/olimart/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/olimart/queenbee","description":"","fork":false,"url":"https://api.github.com/repos/olimart/queenbee","forks_url":"https://api.github.com/repos/olimart/queenbee/forks","keys_url":"https://api.github.com/repos/olimart/queenbee/keys{/key_id}","collaborators_url":"https://api.github.com/repos/olimart/queenbee/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/olimart/queenbee/teams","hooks_url":"https://api.github.com/repos/olimart/queenbee/hooks","issue_events_url":"https://api.github.com/repos/olimart/queenbee/issues/events{/number}","events_url":"https://api.github.com/repos/olimart/queenbee/events","assignees_url":"https://api.github.com/repos/olimart/queenbee/assignees{/user}","branches_url":"https://api.github.com/repos/olimart/queenbee/branches{/branch}","tags_url":"https://api.github.com/repos/olimart/queenbee/tags","blobs_url":"https://api.github.com/repos/olimart/queenbee/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/olimart/queenbee/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/olimart/queenbee/git/refs{/sha}","trees_url":"https://api.github.com/repos/olimart/queenbee/git/trees{/sha}","statuses_url":"https://api.github.com/repos/olimart/queenbee/statuses/{sha}","languages_url":"https://api.github.com/repos/olimart/queenbee/languages","stargazers_url":"https://api.github.com/repos/olimart/queenbee/stargazers","contributors_url":"https://api.github.com/repos/olimart/queenbee/contributors","subscribers_url":"https://api.github.com/repos/olimart/queenbee/subscribers","subscription_url":"https://api.github.com/repos/olimart/queenbee/subscription","commits_url":"https://api.github.com/repos/olimart/queenbee/commits{/sha}","git_commits_url":"https://api.github.com/repos/olimart/queenbee/git/commits{/sha}","comments_url":"https://api.github.com/repos/olimart/queenbee/comments{/number}","issue_comment_url":"https://api.github.com/repos/olimart/queenbee/issues/comments{/number}","contents_url":"https://api.github.com/repos/olimart/queenbee/contents/{+path}","compare_url":"https://api.github.com/repos/olimart/queenbee/compare/{base}...{head}","merges_url":"https://api.github.com/repos/olimart/queenbee/merges","archive_url":"https://api.github.com/repos/olimart/queenbee/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/olimart/queenbee/downloads","issues_url":"https://api.github.com/repos/olimart/queenbee/issues{/number}","pulls_url":"https://api.github.com/repos/olimart/queenbee/pulls{/number}","milestones_url":"https://api.github.com/repos/olimart/queenbee/milestones{/number}","notifications_url":"https://api.github.com/repos/olimart/queenbee/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/olimart/queenbee/labels{/name}","releases_url":"https://api.github.com/repos/olimart/queenbee/releases{/id}","created_at":"2014-03-26T04:40:51Z","updated_at":"2015-04-27T01:20:15Z","pushed_at":"2015-08-27T06:23:41Z","git_url":"git://github.com/olimart/queenbee.git","ssh_url":"git@github.com:olimart/queenbee.git","clone_url":"https://github.com/olimart/queenbee.git","svn_url":"https://github.com/olimart/queenbee","homepage":null,"size":728,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"olimart:master","ref":"master","sha":"0ab4295acf189c50bedc8d7a1131e11638a84dad","user":{"login":"olimart","id":547754,"avatar_url":"https://avatars.githubusercontent.com/u/547754?v=3","gravatar_id":"","url":"https://api.github.com/users/olimart","html_url":"https://github.com/olimart","followers_url":"https://api.github.com/users/olimart/followers","following_url":"https://api.github.com/users/olimart/following{/other_user}","gists_url":"https://api.github.com/users/olimart/gists{/gist_id}","starred_url":"https://api.github.com/users/olimart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olimart/subscriptions","organizations_url":"https://api.github.com/users/olimart/orgs","repos_url":"https://api.github.com/users/olimart/repos","events_url":"https://api.github.com/users/olimart/events{/privacy}","received_events_url":"https://api.github.com/users/olimart/received_events","type":"User","site_admin":false},"repo":{"id":18127043,"name":"queenbee","full_name":"olimart/queenbee","owner":{"login":"olimart","id":547754,"avatar_url":"https://avatars.githubusercontent.com/u/547754?v=3","gravatar_id":"","url":"https://api.github.com/users/olimart","html_url":"https://github.com/olimart","followers_url":"https://api.github.com/users/olimart/followers","following_url":"https://api.github.com/users/olimart/following{/other_user}","gists_url":"https://api.github.com/users/olimart/gists{/gist_id}","starred_url":"https://api.github.com/users/olimart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olimart/subscriptions","organizations_url":"https://api.github.com/users/olimart/orgs","repos_url":"https://api.github.com/users/olimart/repos","events_url":"https://api.github.com/users/olimart/events{/privacy}","received_events_url":"https://api.github.com/users/olimart/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/olimart/queenbee","description":"","fork":false,"url":"https://api.github.com/repos/olimart/queenbee","forks_url":"https://api.github.com/repos/olimart/queenbee/forks","keys_url":"https://api.github.com/repos/olimart/queenbee/keys{/key_id}","collaborators_url":"https://api.github.com/repos/olimart/queenbee/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/olimart/queenbee/teams","hooks_url":"https://api.github.com/repos/olimart/queenbee/hooks","issue_events_url":"https://api.github.com/repos/olimart/queenbee/issues/events{/number}","events_url":"https://api.github.com/repos/olimart/queenbee/events","assignees_url":"https://api.github.com/repos/olimart/queenbee/assignees{/user}","branches_url":"https://api.github.com/repos/olimart/queenbee/branches{/branch}","tags_url":"https://api.github.com/repos/olimart/queenbee/tags","blobs_url":"https://api.github.com/repos/olimart/queenbee/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/olimart/queenbee/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/olimart/queenbee/git/refs{/sha}","trees_url":"https://api.github.com/repos/olimart/queenbee/git/trees{/sha}","statuses_url":"https://api.github.com/repos/olimart/queenbee/statuses/{sha}","languages_url":"https://api.github.com/repos/olimart/queenbee/languages","stargazers_url":"https://api.github.com/repos/olimart/queenbee/stargazers","contributors_url":"https://api.github.com/repos/olimart/queenbee/contributors","subscribers_url":"https://api.github.com/repos/olimart/queenbee/subscribers","subscription_url":"https://api.github.com/repos/olimart/queenbee/subscription","commits_url":"https://api.github.com/repos/olimart/queenbee/commits{/sha}","git_commits_url":"https://api.github.com/repos/olimart/queenbee/git/commits{/sha}","comments_url":"https://api.github.com/repos/olimart/queenbee/comments{/number}","issue_comment_url":"https://api.github.com/repos/olimart/queenbee/issues/comments{/number}","contents_url":"https://api.github.com/repos/olimart/queenbee/contents/{+path}","compare_url":"https://api.github.com/repos/olimart/queenbee/compare/{base}...{head}","merges_url":"https://api.github.com/repos/olimart/queenbee/merges","archive_url":"https://api.github.com/repos/olimart/queenbee/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/olimart/queenbee/downloads","issues_url":"https://api.github.com/repos/olimart/queenbee/issues{/number}","pulls_url":"https://api.github.com/repos/olimart/queenbee/pulls{/number}","milestones_url":"https://api.github.com/repos/olimart/queenbee/milestones{/number}","notifications_url":"https://api.github.com/repos/olimart/queenbee/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/olimart/queenbee/labels{/name}","releases_url":"https://api.github.com/repos/olimart/queenbee/releases{/id}","created_at":"2014-03-26T04:40:51Z","updated_at":"2015-04-27T01:20:15Z","pushed_at":"2015-08-27T06:23:41Z","git_url":"git://github.com/olimart/queenbee.git","ssh_url":"git@github.com:olimart/queenbee.git","clone_url":"https://github.com/olimart/queenbee.git","svn_url":"https://github.com/olimart/queenbee","homepage":null,"size":728,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/olimart/queenbee/pulls/2"},"html":{"href":"https://github.com/olimart/queenbee/pull/2"},"issue":{"href":"https://api.github.com/repos/olimart/queenbee/issues/2"},"comments":{"href":"https://api.github.com/repos/olimart/queenbee/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/olimart/queenbee/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/olimart/queenbee/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/olimart/queenbee/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/olimart/queenbee/statuses/bbd81211851ad7ce00393ba3a7817beb0633d749"}}}}