{"action":"created","comment":{"url":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls/comments/69059903","id":69059903,"diff_hunk":"@@ -20,38 +20,29 @@ def name\n   end\n \n   def today?(field)\n-    next_date(field) == Date.today\n+    next_date(field) == get_today\n   end\n \n   def age_offset(field)\n-    if today?(field)\n-      0\n-    else\n-      1\n-    end\n+    today?(field) ? 0 : 1\n   end\n \n   def self.get_users(field, time_interval = 7.days)\n     time_interval = duration_to_integer(time_interval)\n+\n     get_annual_sql = <<-SQL\n-                          DATE_PART(\n-                               'year',\n-                               age(now() + interval ?, #{field})\n-                          ) - DATE_PART(\n-                            'year',\n-                            age(#{field})\n-                        ) = 1\n-                        SQL\n-    get_todays_events =\n-      <<-SQL\n-      DATE_PART('day', now()) = DATE_PART('day', #{field}) AND\n-      DATE_PART( 'month', now()) = DATE_PART( 'month', #{field})\n-      SQL\n-    users = User.where(get_annual_sql, \"#{time_interval} days\")\n-    users << User.where(get_todays_events).to_a\n-    users.flatten.map do |user|\n-      UserWithDates.new(user)\n-    end\n+      DATE_PART('year', age(now() + interval ?, #{field})) -\n+      DATE_PART('year', age(#{field})) = 1\n+    SQL\n+\n+    get_todays_events = <<-SQL\n+      DATE_PART('day',   now()) = DATE_PART('day',   #{field}) AND\n+      DATE_PART('month', now()) = DATE_PART('month', #{field})\n+    SQL\n+\n+    users = User.where(get_annual_sql, \"#{time_interval} days\") | User.where(get_todays_events)","path":"app/models/user_with_dates.rb","position":63,"original_position":63,"commit_id":"faa31ddd03f4acebe3d978b132953f4277b9fe22","original_commit_id":"faa31ddd03f4acebe3d978b132953f4277b9fe22","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Line is too long. [95/80]","created_at":"2016-06-30T02:13:48Z","updated_at":"2016-06-30T02:13:48Z","html_url":"https://github.com/lunarcollective/employee-scheduling/pull/16#discussion_r69059903","pull_request_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls/comments/69059903"},"html":{"href":"https://github.com/lunarcollective/employee-scheduling/pull/16#discussion_r69059903"},"pull_request":{"href":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls/16","id":75750400,"html_url":"https://github.com/lunarcollective/employee-scheduling/pull/16","diff_url":"https://github.com/lunarcollective/employee-scheduling/pull/16.diff","patch_url":"https://github.com/lunarcollective/employee-scheduling/pull/16.patch","issue_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/issues/16","number":16,"state":"open","locked":false,"title":"User with dates refactors","user":{"login":"jah2488","id":249209,"avatar_url":"https://avatars.githubusercontent.com/u/249209?v=3","gravatar_id":"","url":"https://api.github.com/users/jah2488","html_url":"https://github.com/jah2488","followers_url":"https://api.github.com/users/jah2488/followers","following_url":"https://api.github.com/users/jah2488/following{/other_user}","gists_url":"https://api.github.com/users/jah2488/gists{/gist_id}","starred_url":"https://api.github.com/users/jah2488/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jah2488/subscriptions","organizations_url":"https://api.github.com/users/jah2488/orgs","repos_url":"https://api.github.com/users/jah2488/repos","events_url":"https://api.github.com/users/jah2488/events{/privacy}","received_events_url":"https://api.github.com/users/jah2488/received_events","type":"User","site_admin":false},"body":"Made a few changes to the user_with_dates, mainly around making sure we're not backing ourselves into a corner with time zones.","created_at":"2016-06-30T02:12:04Z","updated_at":"2016-06-30T02:13:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9b94a88a5f0b5d2268cb846194bf4933665c42b0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls/16/commits","review_comments_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls/16/comments","review_comment_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/issues/16/comments","statuses_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/statuses/faa31ddd03f4acebe3d978b132953f4277b9fe22","head":{"label":"lunarcollective:user_with_dates_refactors","ref":"user_with_dates_refactors","sha":"faa31ddd03f4acebe3d978b132953f4277b9fe22","user":{"login":"lunarcollective","id":17710679,"avatar_url":"https://avatars.githubusercontent.com/u/17710679?v=3","gravatar_id":"","url":"https://api.github.com/users/lunarcollective","html_url":"https://github.com/lunarcollective","followers_url":"https://api.github.com/users/lunarcollective/followers","following_url":"https://api.github.com/users/lunarcollective/following{/other_user}","gists_url":"https://api.github.com/users/lunarcollective/gists{/gist_id}","starred_url":"https://api.github.com/users/lunarcollective/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lunarcollective/subscriptions","organizations_url":"https://api.github.com/users/lunarcollective/orgs","repos_url":"https://api.github.com/users/lunarcollective/repos","events_url":"https://api.github.com/users/lunarcollective/events{/privacy}","received_events_url":"https://api.github.com/users/lunarcollective/received_events","type":"Organization","site_admin":false},"repo":{"id":61505109,"name":"employee-scheduling","full_name":"lunarcollective/employee-scheduling","owner":{"login":"lunarcollective","id":17710679,"avatar_url":"https://avatars.githubusercontent.com/u/17710679?v=3","gravatar_id":"","url":"https://api.github.com/users/lunarcollective","html_url":"https://github.com/lunarcollective","followers_url":"https://api.github.com/users/lunarcollective/followers","following_url":"https://api.github.com/users/lunarcollective/following{/other_user}","gists_url":"https://api.github.com/users/lunarcollective/gists{/gist_id}","starred_url":"https://api.github.com/users/lunarcollective/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lunarcollective/subscriptions","organizations_url":"https://api.github.com/users/lunarcollective/orgs","repos_url":"https://api.github.com/users/lunarcollective/repos","events_url":"https://api.github.com/users/lunarcollective/events{/privacy}","received_events_url":"https://api.github.com/users/lunarcollective/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lunarcollective/employee-scheduling","description":null,"fork":false,"url":"https://api.github.com/repos/lunarcollective/employee-scheduling","forks_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/forks","keys_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/teams","hooks_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/hooks","issue_events_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/issues/events{/number}","events_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/events","assignees_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/assignees{/user}","branches_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/branches{/branch}","tags_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/tags","blobs_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/git/refs{/sha}","trees_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/statuses/{sha}","languages_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/languages","stargazers_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/stargazers","contributors_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/contributors","subscribers_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/subscribers","subscription_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/subscription","commits_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/commits{/sha}","git_commits_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/git/commits{/sha}","comments_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/comments{/number}","issue_comment_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/issues/comments{/number}","contents_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/contents/{+path}","compare_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/merges","archive_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/downloads","issues_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/issues{/number}","pulls_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls{/number}","milestones_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/milestones{/number}","notifications_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/labels{/name}","releases_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/releases{/id}","deployments_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/deployments","created_at":"2016-06-19T23:29:22Z","updated_at":"2016-06-27T14:28:51Z","pushed_at":"2016-06-30T02:13:44Z","git_url":"git://github.com/lunarcollective/employee-scheduling.git","ssh_url":"git@github.com:lunarcollective/employee-scheduling.git","clone_url":"https://github.com/lunarcollective/employee-scheduling.git","svn_url":"https://github.com/lunarcollective/employee-scheduling","homepage":null,"size":160,"stargazers_count":3,"watchers_count":3,"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":3,"default_branch":"master"}},"base":{"label":"lunarcollective:master","ref":"master","sha":"fcf7866ddfae7749cbe26b82d2f8c6528f8348a0","user":{"login":"lunarcollective","id":17710679,"avatar_url":"https://avatars.githubusercontent.com/u/17710679?v=3","gravatar_id":"","url":"https://api.github.com/users/lunarcollective","html_url":"https://github.com/lunarcollective","followers_url":"https://api.github.com/users/lunarcollective/followers","following_url":"https://api.github.com/users/lunarcollective/following{/other_user}","gists_url":"https://api.github.com/users/lunarcollective/gists{/gist_id}","starred_url":"https://api.github.com/users/lunarcollective/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lunarcollective/subscriptions","organizations_url":"https://api.github.com/users/lunarcollective/orgs","repos_url":"https://api.github.com/users/lunarcollective/repos","events_url":"https://api.github.com/users/lunarcollective/events{/privacy}","received_events_url":"https://api.github.com/users/lunarcollective/received_events","type":"Organization","site_admin":false},"repo":{"id":61505109,"name":"employee-scheduling","full_name":"lunarcollective/employee-scheduling","owner":{"login":"lunarcollective","id":17710679,"avatar_url":"https://avatars.githubusercontent.com/u/17710679?v=3","gravatar_id":"","url":"https://api.github.com/users/lunarcollective","html_url":"https://github.com/lunarcollective","followers_url":"https://api.github.com/users/lunarcollective/followers","following_url":"https://api.github.com/users/lunarcollective/following{/other_user}","gists_url":"https://api.github.com/users/lunarcollective/gists{/gist_id}","starred_url":"https://api.github.com/users/lunarcollective/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lunarcollective/subscriptions","organizations_url":"https://api.github.com/users/lunarcollective/orgs","repos_url":"https://api.github.com/users/lunarcollective/repos","events_url":"https://api.github.com/users/lunarcollective/events{/privacy}","received_events_url":"https://api.github.com/users/lunarcollective/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lunarcollective/employee-scheduling","description":null,"fork":false,"url":"https://api.github.com/repos/lunarcollective/employee-scheduling","forks_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/forks","keys_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/teams","hooks_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/hooks","issue_events_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/issues/events{/number}","events_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/events","assignees_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/assignees{/user}","branches_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/branches{/branch}","tags_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/tags","blobs_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/git/refs{/sha}","trees_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/statuses/{sha}","languages_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/languages","stargazers_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/stargazers","contributors_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/contributors","subscribers_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/subscribers","subscription_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/subscription","commits_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/commits{/sha}","git_commits_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/git/commits{/sha}","comments_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/comments{/number}","issue_comment_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/issues/comments{/number}","contents_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/contents/{+path}","compare_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/merges","archive_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/downloads","issues_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/issues{/number}","pulls_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls{/number}","milestones_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/milestones{/number}","notifications_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/labels{/name}","releases_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/releases{/id}","deployments_url":"https://api.github.com/repos/lunarcollective/employee-scheduling/deployments","created_at":"2016-06-19T23:29:22Z","updated_at":"2016-06-27T14:28:51Z","pushed_at":"2016-06-30T02:13:44Z","git_url":"git://github.com/lunarcollective/employee-scheduling.git","ssh_url":"git@github.com:lunarcollective/employee-scheduling.git","clone_url":"https://github.com/lunarcollective/employee-scheduling.git","svn_url":"https://github.com/lunarcollective/employee-scheduling","homepage":null,"size":160,"stargazers_count":3,"watchers_count":3,"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":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls/16"},"html":{"href":"https://github.com/lunarcollective/employee-scheduling/pull/16"},"issue":{"href":"https://api.github.com/repos/lunarcollective/employee-scheduling/issues/16"},"comments":{"href":"https://api.github.com/repos/lunarcollective/employee-scheduling/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lunarcollective/employee-scheduling/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/lunarcollective/employee-scheduling/statuses/faa31ddd03f4acebe3d978b132953f4277b9fe22"}}}}
{"actor":{"display_login":"houndci-bot"}}