{"action":"created","comment":{"url":"https://api.github.com/repos/collectiveidea/hourglass/pulls/comments/28813043","id":28813043,"diff_hunk":"@@ -0,0 +1,18 @@\n+class SendTimerReminders\n+  include Interactor\n+  include HasHarvest\n+\n+  before do\n+    context.date ||= Date.current\n+  end\n+\n+  def call\n+    User.all.each do |user|\n+      next if user.timer_reminder_sent_on.try(:today?)","path":"app/interactors/send_timer_reminders.rb","position":null,"original_position":11,"commit_id":"f7d2e995b034be96b4142eb76a38a446fc02f8ea","original_commit_id":"6f413b5cbb14d0b2417957fffc57efe2aa42a201","user":{"login":"danielmorrison","id":125,"avatar_url":"https://avatars.githubusercontent.com/u/125?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmorrison","html_url":"https://github.com/danielmorrison","followers_url":"https://api.github.com/users/danielmorrison/followers","following_url":"https://api.github.com/users/danielmorrison/following{/other_user}","gists_url":"https://api.github.com/users/danielmorrison/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmorrison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmorrison/subscriptions","organizations_url":"https://api.github.com/users/danielmorrison/orgs","repos_url":"https://api.github.com/users/danielmorrison/repos","events_url":"https://api.github.com/users/danielmorrison/events{/privacy}","received_events_url":"https://api.github.com/users/danielmorrison/received_events","type":"User","site_admin":false},"body":"I guess I disagree. This is a very simple query (the field name makes it long) and even though we're dealing with a small number of users, alarms went on in my head immediately when I saw both the `.all` and the checking in Ruby. \r\n\r\nIf you don't like the null check, remove the null and set an initial date to `created_at` or something.","created_at":"2015-04-21T19:25:33Z","updated_at":"2015-04-21T19:25:33Z","html_url":"https://github.com/collectiveidea/hourglass/pull/16#discussion_r28813043","pull_request_url":"https://api.github.com/repos/collectiveidea/hourglass/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/collectiveidea/hourglass/pulls/comments/28813043"},"html":{"href":"https://github.com/collectiveidea/hourglass/pull/16#discussion_r28813043"},"pull_request":{"href":"https://api.github.com/repos/collectiveidea/hourglass/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/collectiveidea/hourglass/pulls/16","id":33760392,"html_url":"https://github.com/collectiveidea/hourglass/pull/16","diff_url":"https://github.com/collectiveidea/hourglass/pull/16.diff","patch_url":"https://github.com/collectiveidea/hourglass/pull/16.patch","issue_url":"https://api.github.com/repos/collectiveidea/hourglass/issues/16","number":16,"state":"open","locked":false,"title":"Send timer reminder emails","user":{"login":"laserlemon","id":34264,"avatar_url":"https://avatars.githubusercontent.com/u/34264?v=3","gravatar_id":"","url":"https://api.github.com/users/laserlemon","html_url":"https://github.com/laserlemon","followers_url":"https://api.github.com/users/laserlemon/followers","following_url":"https://api.github.com/users/laserlemon/following{/other_user}","gists_url":"https://api.github.com/users/laserlemon/gists{/gist_id}","starred_url":"https://api.github.com/users/laserlemon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laserlemon/subscriptions","organizations_url":"https://api.github.com/users/laserlemon/orgs","repos_url":"https://api.github.com/users/laserlemon/repos","events_url":"https://api.github.com/users/laserlemon/events{/privacy}","received_events_url":"https://api.github.com/users/laserlemon/received_events","type":"User","site_admin":false},"body":"If a user hasn't started a timer by a configured time in the morning, he or she receives an email reminder to either start a timer or to update the Zenefits PTO calendar. If the user already has PTO scheduled in the Zenefits calendar, a reminder is never sent.\r\n\r\n## TODO\r\n\r\n* [x] Determine appropriate morning check-in time **(10am Eastern)**\r\n* [x] ~~Send reminders at the specified time in the _user's_ time zone~~\r\n* [x] Set up `rake hourglass:send_timer_reminders` on Heroku scheduler\r\n* [x] Skip timer reminders for holidays and scheduled PTO\r\n* [x] Set `ZENEFITS_PTO_CALENDAR_URL` in production\r\n* [x] Set up `rake hourglass:sync_pto` on Heroku scheduler\r\n","created_at":"2015-04-21T13:24:02Z","updated_at":"2015-04-21T19:25:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c76c7a20e67569622c6a5ddd87fad6673292afd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/collectiveidea/hourglass/pulls/16/commits","review_comments_url":"https://api.github.com/repos/collectiveidea/hourglass/pulls/16/comments","review_comment_url":"https://api.github.com/repos/collectiveidea/hourglass/pulls/comments{/number}","comments_url":"https://api.github.com/repos/collectiveidea/hourglass/issues/16/comments","statuses_url":"https://api.github.com/repos/collectiveidea/hourglass/statuses/f7d2e995b034be96b4142eb76a38a446fc02f8ea","head":{"label":"collectiveidea:timer-reminder","ref":"timer-reminder","sha":"f7d2e995b034be96b4142eb76a38a446fc02f8ea","user":{"login":"collectiveidea","id":128,"avatar_url":"https://avatars.githubusercontent.com/u/128?v=3","gravatar_id":"","url":"https://api.github.com/users/collectiveidea","html_url":"https://github.com/collectiveidea","followers_url":"https://api.github.com/users/collectiveidea/followers","following_url":"https://api.github.com/users/collectiveidea/following{/other_user}","gists_url":"https://api.github.com/users/collectiveidea/gists{/gist_id}","starred_url":"https://api.github.com/users/collectiveidea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/collectiveidea/subscriptions","organizations_url":"https://api.github.com/users/collectiveidea/orgs","repos_url":"https://api.github.com/users/collectiveidea/repos","events_url":"https://api.github.com/users/collectiveidea/events{/privacy}","received_events_url":"https://api.github.com/users/collectiveidea/received_events","type":"Organization","site_admin":false},"repo":{"id":13967112,"name":"hourglass","full_name":"collectiveidea/hourglass","owner":{"login":"collectiveidea","id":128,"avatar_url":"https://avatars.githubusercontent.com/u/128?v=3","gravatar_id":"","url":"https://api.github.com/users/collectiveidea","html_url":"https://github.com/collectiveidea","followers_url":"https://api.github.com/users/collectiveidea/followers","following_url":"https://api.github.com/users/collectiveidea/following{/other_user}","gists_url":"https://api.github.com/users/collectiveidea/gists{/gist_id}","starred_url":"https://api.github.com/users/collectiveidea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/collectiveidea/subscriptions","organizations_url":"https://api.github.com/users/collectiveidea/orgs","repos_url":"https://api.github.com/users/collectiveidea/repos","events_url":"https://api.github.com/users/collectiveidea/events{/privacy}","received_events_url":"https://api.github.com/users/collectiveidea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/collectiveidea/hourglass","description":"Client and internal time management with Harvest","fork":false,"url":"https://api.github.com/repos/collectiveidea/hourglass","forks_url":"https://api.github.com/repos/collectiveidea/hourglass/forks","keys_url":"https://api.github.com/repos/collectiveidea/hourglass/keys{/key_id}","collaborators_url":"https://api.github.com/repos/collectiveidea/hourglass/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/collectiveidea/hourglass/teams","hooks_url":"https://api.github.com/repos/collectiveidea/hourglass/hooks","issue_events_url":"https://api.github.com/repos/collectiveidea/hourglass/issues/events{/number}","events_url":"https://api.github.com/repos/collectiveidea/hourglass/events","assignees_url":"https://api.github.com/repos/collectiveidea/hourglass/assignees{/user}","branches_url":"https://api.github.com/repos/collectiveidea/hourglass/branches{/branch}","tags_url":"https://api.github.com/repos/collectiveidea/hourglass/tags","blobs_url":"https://api.github.com/repos/collectiveidea/hourglass/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/collectiveidea/hourglass/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/collectiveidea/hourglass/git/refs{/sha}","trees_url":"https://api.github.com/repos/collectiveidea/hourglass/git/trees{/sha}","statuses_url":"https://api.github.com/repos/collectiveidea/hourglass/statuses/{sha}","languages_url":"https://api.github.com/repos/collectiveidea/hourglass/languages","stargazers_url":"https://api.github.com/repos/collectiveidea/hourglass/stargazers","contributors_url":"https://api.github.com/repos/collectiveidea/hourglass/contributors","subscribers_url":"https://api.github.com/repos/collectiveidea/hourglass/subscribers","subscription_url":"https://api.github.com/repos/collectiveidea/hourglass/subscription","commits_url":"https://api.github.com/repos/collectiveidea/hourglass/commits{/sha}","git_commits_url":"https://api.github.com/repos/collectiveidea/hourglass/git/commits{/sha}","comments_url":"https://api.github.com/repos/collectiveidea/hourglass/comments{/number}","issue_comment_url":"https://api.github.com/repos/collectiveidea/hourglass/issues/comments{/number}","contents_url":"https://api.github.com/repos/collectiveidea/hourglass/contents/{+path}","compare_url":"https://api.github.com/repos/collectiveidea/hourglass/compare/{base}...{head}","merges_url":"https://api.github.com/repos/collectiveidea/hourglass/merges","archive_url":"https://api.github.com/repos/collectiveidea/hourglass/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/collectiveidea/hourglass/downloads","issues_url":"https://api.github.com/repos/collectiveidea/hourglass/issues{/number}","pulls_url":"https://api.github.com/repos/collectiveidea/hourglass/pulls{/number}","milestones_url":"https://api.github.com/repos/collectiveidea/hourglass/milestones{/number}","notifications_url":"https://api.github.com/repos/collectiveidea/hourglass/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/collectiveidea/hourglass/labels{/name}","releases_url":"https://api.github.com/repos/collectiveidea/hourglass/releases{/id}","created_at":"2013-10-29T20:04:01Z","updated_at":"2015-04-21T10:43:12Z","pushed_at":"2015-04-21T19:10:57Z","git_url":"git://github.com/collectiveidea/hourglass.git","ssh_url":"git@github.com:collectiveidea/hourglass.git","clone_url":"https://github.com/collectiveidea/hourglass.git","svn_url":"https://github.com/collectiveidea/hourglass","homepage":"hourglass.collectiveidea.com","size":661,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"collectiveidea:master","ref":"master","sha":"af3d0b3bc8d0d19ddc923c22d0e7336f0aeb8d0f","user":{"login":"collectiveidea","id":128,"avatar_url":"https://avatars.githubusercontent.com/u/128?v=3","gravatar_id":"","url":"https://api.github.com/users/collectiveidea","html_url":"https://github.com/collectiveidea","followers_url":"https://api.github.com/users/collectiveidea/followers","following_url":"https://api.github.com/users/collectiveidea/following{/other_user}","gists_url":"https://api.github.com/users/collectiveidea/gists{/gist_id}","starred_url":"https://api.github.com/users/collectiveidea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/collectiveidea/subscriptions","organizations_url":"https://api.github.com/users/collectiveidea/orgs","repos_url":"https://api.github.com/users/collectiveidea/repos","events_url":"https://api.github.com/users/collectiveidea/events{/privacy}","received_events_url":"https://api.github.com/users/collectiveidea/received_events","type":"Organization","site_admin":false},"repo":{"id":13967112,"name":"hourglass","full_name":"collectiveidea/hourglass","owner":{"login":"collectiveidea","id":128,"avatar_url":"https://avatars.githubusercontent.com/u/128?v=3","gravatar_id":"","url":"https://api.github.com/users/collectiveidea","html_url":"https://github.com/collectiveidea","followers_url":"https://api.github.com/users/collectiveidea/followers","following_url":"https://api.github.com/users/collectiveidea/following{/other_user}","gists_url":"https://api.github.com/users/collectiveidea/gists{/gist_id}","starred_url":"https://api.github.com/users/collectiveidea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/collectiveidea/subscriptions","organizations_url":"https://api.github.com/users/collectiveidea/orgs","repos_url":"https://api.github.com/users/collectiveidea/repos","events_url":"https://api.github.com/users/collectiveidea/events{/privacy}","received_events_url":"https://api.github.com/users/collectiveidea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/collectiveidea/hourglass","description":"Client and internal time management with Harvest","fork":false,"url":"https://api.github.com/repos/collectiveidea/hourglass","forks_url":"https://api.github.com/repos/collectiveidea/hourglass/forks","keys_url":"https://api.github.com/repos/collectiveidea/hourglass/keys{/key_id}","collaborators_url":"https://api.github.com/repos/collectiveidea/hourglass/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/collectiveidea/hourglass/teams","hooks_url":"https://api.github.com/repos/collectiveidea/hourglass/hooks","issue_events_url":"https://api.github.com/repos/collectiveidea/hourglass/issues/events{/number}","events_url":"https://api.github.com/repos/collectiveidea/hourglass/events","assignees_url":"https://api.github.com/repos/collectiveidea/hourglass/assignees{/user}","branches_url":"https://api.github.com/repos/collectiveidea/hourglass/branches{/branch}","tags_url":"https://api.github.com/repos/collectiveidea/hourglass/tags","blobs_url":"https://api.github.com/repos/collectiveidea/hourglass/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/collectiveidea/hourglass/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/collectiveidea/hourglass/git/refs{/sha}","trees_url":"https://api.github.com/repos/collectiveidea/hourglass/git/trees{/sha}","statuses_url":"https://api.github.com/repos/collectiveidea/hourglass/statuses/{sha}","languages_url":"https://api.github.com/repos/collectiveidea/hourglass/languages","stargazers_url":"https://api.github.com/repos/collectiveidea/hourglass/stargazers","contributors_url":"https://api.github.com/repos/collectiveidea/hourglass/contributors","subscribers_url":"https://api.github.com/repos/collectiveidea/hourglass/subscribers","subscription_url":"https://api.github.com/repos/collectiveidea/hourglass/subscription","commits_url":"https://api.github.com/repos/collectiveidea/hourglass/commits{/sha}","git_commits_url":"https://api.github.com/repos/collectiveidea/hourglass/git/commits{/sha}","comments_url":"https://api.github.com/repos/collectiveidea/hourglass/comments{/number}","issue_comment_url":"https://api.github.com/repos/collectiveidea/hourglass/issues/comments{/number}","contents_url":"https://api.github.com/repos/collectiveidea/hourglass/contents/{+path}","compare_url":"https://api.github.com/repos/collectiveidea/hourglass/compare/{base}...{head}","merges_url":"https://api.github.com/repos/collectiveidea/hourglass/merges","archive_url":"https://api.github.com/repos/collectiveidea/hourglass/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/collectiveidea/hourglass/downloads","issues_url":"https://api.github.com/repos/collectiveidea/hourglass/issues{/number}","pulls_url":"https://api.github.com/repos/collectiveidea/hourglass/pulls{/number}","milestones_url":"https://api.github.com/repos/collectiveidea/hourglass/milestones{/number}","notifications_url":"https://api.github.com/repos/collectiveidea/hourglass/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/collectiveidea/hourglass/labels{/name}","releases_url":"https://api.github.com/repos/collectiveidea/hourglass/releases{/id}","created_at":"2013-10-29T20:04:01Z","updated_at":"2015-04-21T10:43:12Z","pushed_at":"2015-04-21T19:10:57Z","git_url":"git://github.com/collectiveidea/hourglass.git","ssh_url":"git@github.com:collectiveidea/hourglass.git","clone_url":"https://github.com/collectiveidea/hourglass.git","svn_url":"https://github.com/collectiveidea/hourglass","homepage":"hourglass.collectiveidea.com","size":661,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/collectiveidea/hourglass/pulls/16"},"html":{"href":"https://github.com/collectiveidea/hourglass/pull/16"},"issue":{"href":"https://api.github.com/repos/collectiveidea/hourglass/issues/16"},"comments":{"href":"https://api.github.com/repos/collectiveidea/hourglass/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/collectiveidea/hourglass/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/collectiveidea/hourglass/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/collectiveidea/hourglass/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/collectiveidea/hourglass/statuses/f7d2e995b034be96b4142eb76a38a446fc02f8ea"}}}}