{"action":"created","comment":{"url":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls/comments/195374410","pull_request_review_id":128724746,"id":195374410,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NTM3NDQxMA==","diff_hunk":"@@ -5,4 +5,12 @@ def threshold_email_reminder(admin_users, petitions)\n     @petitions = petitions\n     mail(subject: \"Petitions alert\", to: admin_users.map(&:email))\n   end\n+\n+  def petitions_report\n+    @petitions = Petition.recently_opened_or_signed\n+\n+    subject = \"E-petitions report #{(Date.current - 1.week).strftime(\"%d %b %Y\")} - #{Date.current.strftime(\"%d %b %Y\")}\"","path":"app/mailers/admin_mailer.rb","position":8,"original_position":8,"commit_id":"dd6b715ecfcbde457b50b918673f90960d0ead75","original_commit_id":"dd6b715ecfcbde457b50b918673f90960d0ead75","user":{"login":"pixeltrix","id":6321,"node_id":"MDQ6VXNlcjYzMjE=","avatar_url":"https://avatars0.githubusercontent.com/u/6321?v=4","gravatar_id":"","url":"https://api.github.com/users/pixeltrix","html_url":"https://github.com/pixeltrix","followers_url":"https://api.github.com/users/pixeltrix/followers","following_url":"https://api.github.com/users/pixeltrix/following{/other_user}","gists_url":"https://api.github.com/users/pixeltrix/gists{/gist_id}","starred_url":"https://api.github.com/users/pixeltrix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixeltrix/subscriptions","organizations_url":"https://api.github.com/users/pixeltrix/orgs","repos_url":"https://api.github.com/users/pixeltrix/repos","events_url":"https://api.github.com/users/pixeltrix/events{/privacy}","received_events_url":"https://api.github.com/users/pixeltrix/received_events","type":"User","site_admin":false},"body":"I would probably inject these values as default args, e.g.\r\n\r\n``` ruby\r\ndef petitions_report(now = Time.current.beginning_of_day)\r\n  since = 1.week.since(now)\r\n  subject = \"Petitions report #{since.strftime(\"%d %b %Y\")} - #{now.strftime(\"%d %b %Y\")}\"\r\n\r\n  @petitions = Petition.recently_opened_or_signed\r\n\r\n  mail(subject: subject, to: Site.report_email)\r\nend\r\n```\r\n\r\nI'd probably also change the `recently_opened_or_signed` to `opened_or_signed_within` and pass those values into that method.","created_at":"2018-06-14T10:33:05Z","updated_at":"2018-06-14T10:35:38Z","html_url":"https://github.com/StatesOfJersey/e-petitions/pull/38#discussion_r195374410","pull_request_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls/38","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls/comments/195374410"},"html":{"href":"https://github.com/StatesOfJersey/e-petitions/pull/38#discussion_r195374410"},"pull_request":{"href":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls/38","id":194841663,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0ODQxNjYz","html_url":"https://github.com/StatesOfJersey/e-petitions/pull/38","diff_url":"https://github.com/StatesOfJersey/e-petitions/pull/38.diff","patch_url":"https://github.com/StatesOfJersey/e-petitions/pull/38.patch","issue_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/issues/38","number":38,"state":"open","locked":false,"title":"Weekly Petitions report email to members","user":{"login":"NeilvB","id":1370570,"node_id":"MDQ6VXNlcjEzNzA1NzA=","avatar_url":"https://avatars2.githubusercontent.com/u/1370570?v=4","gravatar_id":"","url":"https://api.github.com/users/NeilvB","html_url":"https://github.com/NeilvB","followers_url":"https://api.github.com/users/NeilvB/followers","following_url":"https://api.github.com/users/NeilvB/following{/other_user}","gists_url":"https://api.github.com/users/NeilvB/gists{/gist_id}","starred_url":"https://api.github.com/users/NeilvB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NeilvB/subscriptions","organizations_url":"https://api.github.com/users/NeilvB/orgs","repos_url":"https://api.github.com/users/NeilvB/repos","events_url":"https://api.github.com/users/NeilvB/events{/privacy}","received_events_url":"https://api.github.com/users/NeilvB/received_events","type":"User","site_admin":false},"body":"Adds a weekly reporting email to members to inform them of petitions opened or signed in the last week.\r\n\r\nHTML preview:\r\n\r\n<img width=\"522\" alt=\"screen shot 2018-06-14 at 11 06 10\" src=\"https://user-images.githubusercontent.com/1370570/41405959-faa80bbc-6fc2-11e8-99cf-c4ccd3a8b3b4.png\">\r\n\r\n","created_at":"2018-06-14T10:06:28Z","updated_at":"2018-06-14T10:35:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d89a928e5cb382e92ff49d25bd29ca5bd6dd2473","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls/38/commits","review_comments_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls/38/comments","review_comment_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls/comments{/number}","comments_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/issues/38/comments","statuses_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/statuses/dd6b715ecfcbde457b50b918673f90960d0ead75","head":{"label":"StatesOfJersey:weekly_email","ref":"weekly_email","sha":"dd6b715ecfcbde457b50b918673f90960d0ead75","user":{"login":"StatesOfJersey","id":20908909,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwOTA4OTA5","avatar_url":"https://avatars2.githubusercontent.com/u/20908909?v=4","gravatar_id":"","url":"https://api.github.com/users/StatesOfJersey","html_url":"https://github.com/StatesOfJersey","followers_url":"https://api.github.com/users/StatesOfJersey/followers","following_url":"https://api.github.com/users/StatesOfJersey/following{/other_user}","gists_url":"https://api.github.com/users/StatesOfJersey/gists{/gist_id}","starred_url":"https://api.github.com/users/StatesOfJersey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StatesOfJersey/subscriptions","organizations_url":"https://api.github.com/users/StatesOfJersey/orgs","repos_url":"https://api.github.com/users/StatesOfJersey/repos","events_url":"https://api.github.com/users/StatesOfJersey/events{/privacy}","received_events_url":"https://api.github.com/users/StatesOfJersey/received_events","type":"Organization","site_admin":false},"repo":{"id":80121669,"node_id":"MDEwOlJlcG9zaXRvcnk4MDEyMTY2OQ==","name":"e-petitions","full_name":"StatesOfJersey/e-petitions","owner":{"login":"StatesOfJersey","id":20908909,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwOTA4OTA5","avatar_url":"https://avatars2.githubusercontent.com/u/20908909?v=4","gravatar_id":"","url":"https://api.github.com/users/StatesOfJersey","html_url":"https://github.com/StatesOfJersey","followers_url":"https://api.github.com/users/StatesOfJersey/followers","following_url":"https://api.github.com/users/StatesOfJersey/following{/other_user}","gists_url":"https://api.github.com/users/StatesOfJersey/gists{/gist_id}","starred_url":"https://api.github.com/users/StatesOfJersey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StatesOfJersey/subscriptions","organizations_url":"https://api.github.com/users/StatesOfJersey/orgs","repos_url":"https://api.github.com/users/StatesOfJersey/repos","events_url":"https://api.github.com/users/StatesOfJersey/events{/privacy}","received_events_url":"https://api.github.com/users/StatesOfJersey/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StatesOfJersey/e-petitions","description":"This is the code base for the States of Jersey Government's e-petitions service","fork":true,"url":"https://api.github.com/repos/StatesOfJersey/e-petitions","forks_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/forks","keys_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/teams","hooks_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/hooks","issue_events_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/issues/events{/number}","events_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/events","assignees_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/assignees{/user}","branches_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/branches{/branch}","tags_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/tags","blobs_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/git/refs{/sha}","trees_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/statuses/{sha}","languages_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/languages","stargazers_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/stargazers","contributors_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/contributors","subscribers_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/subscribers","subscription_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/subscription","commits_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/commits{/sha}","git_commits_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/git/commits{/sha}","comments_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/comments{/number}","issue_comment_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/issues/comments{/number}","contents_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/contents/{+path}","compare_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/merges","archive_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/downloads","issues_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/issues{/number}","pulls_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls{/number}","milestones_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/milestones{/number}","notifications_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/labels{/name}","releases_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/releases{/id}","deployments_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/deployments","created_at":"2017-01-26T14:29:59Z","updated_at":"2018-06-13T11:56:40Z","pushed_at":"2018-06-14T10:06:28Z","git_url":"git://github.com/StatesOfJersey/e-petitions.git","ssh_url":"git@github.com:StatesOfJersey/e-petitions.git","clone_url":"https://github.com/StatesOfJersey/e-petitions.git","svn_url":"https://github.com/StatesOfJersey/e-petitions","homepage":"https://petitions.gov.je","size":7906,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"StatesOfJersey:master","ref":"master","sha":"17d97b7ffbc915945cb56a496c76820160f57fbd","user":{"login":"StatesOfJersey","id":20908909,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwOTA4OTA5","avatar_url":"https://avatars2.githubusercontent.com/u/20908909?v=4","gravatar_id":"","url":"https://api.github.com/users/StatesOfJersey","html_url":"https://github.com/StatesOfJersey","followers_url":"https://api.github.com/users/StatesOfJersey/followers","following_url":"https://api.github.com/users/StatesOfJersey/following{/other_user}","gists_url":"https://api.github.com/users/StatesOfJersey/gists{/gist_id}","starred_url":"https://api.github.com/users/StatesOfJersey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StatesOfJersey/subscriptions","organizations_url":"https://api.github.com/users/StatesOfJersey/orgs","repos_url":"https://api.github.com/users/StatesOfJersey/repos","events_url":"https://api.github.com/users/StatesOfJersey/events{/privacy}","received_events_url":"https://api.github.com/users/StatesOfJersey/received_events","type":"Organization","site_admin":false},"repo":{"id":80121669,"node_id":"MDEwOlJlcG9zaXRvcnk4MDEyMTY2OQ==","name":"e-petitions","full_name":"StatesOfJersey/e-petitions","owner":{"login":"StatesOfJersey","id":20908909,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwOTA4OTA5","avatar_url":"https://avatars2.githubusercontent.com/u/20908909?v=4","gravatar_id":"","url":"https://api.github.com/users/StatesOfJersey","html_url":"https://github.com/StatesOfJersey","followers_url":"https://api.github.com/users/StatesOfJersey/followers","following_url":"https://api.github.com/users/StatesOfJersey/following{/other_user}","gists_url":"https://api.github.com/users/StatesOfJersey/gists{/gist_id}","starred_url":"https://api.github.com/users/StatesOfJersey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StatesOfJersey/subscriptions","organizations_url":"https://api.github.com/users/StatesOfJersey/orgs","repos_url":"https://api.github.com/users/StatesOfJersey/repos","events_url":"https://api.github.com/users/StatesOfJersey/events{/privacy}","received_events_url":"https://api.github.com/users/StatesOfJersey/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StatesOfJersey/e-petitions","description":"This is the code base for the States of Jersey Government's e-petitions service","fork":true,"url":"https://api.github.com/repos/StatesOfJersey/e-petitions","forks_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/forks","keys_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/teams","hooks_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/hooks","issue_events_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/issues/events{/number}","events_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/events","assignees_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/assignees{/user}","branches_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/branches{/branch}","tags_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/tags","blobs_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/git/refs{/sha}","trees_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/statuses/{sha}","languages_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/languages","stargazers_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/stargazers","contributors_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/contributors","subscribers_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/subscribers","subscription_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/subscription","commits_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/commits{/sha}","git_commits_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/git/commits{/sha}","comments_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/comments{/number}","issue_comment_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/issues/comments{/number}","contents_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/contents/{+path}","compare_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/merges","archive_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/downloads","issues_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/issues{/number}","pulls_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls{/number}","milestones_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/milestones{/number}","notifications_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/labels{/name}","releases_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/releases{/id}","deployments_url":"https://api.github.com/repos/StatesOfJersey/e-petitions/deployments","created_at":"2017-01-26T14:29:59Z","updated_at":"2018-06-13T11:56:40Z","pushed_at":"2018-06-14T10:06:28Z","git_url":"git://github.com/StatesOfJersey/e-petitions.git","ssh_url":"git@github.com:StatesOfJersey/e-petitions.git","clone_url":"https://github.com/StatesOfJersey/e-petitions.git","svn_url":"https://github.com/StatesOfJersey/e-petitions","homepage":"https://petitions.gov.je","size":7906,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls/38"},"html":{"href":"https://github.com/StatesOfJersey/e-petitions/pull/38"},"issue":{"href":"https://api.github.com/repos/StatesOfJersey/e-petitions/issues/38"},"comments":{"href":"https://api.github.com/repos/StatesOfJersey/e-petitions/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/StatesOfJersey/e-petitions/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/StatesOfJersey/e-petitions/statuses/dd6b715ecfcbde457b50b918673f90960d0ead75"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"pixeltrix"}}