{"action":"created","comment":{"url":"https://api.github.com/repos/magfest/ubersystem/pulls/comments/88053391","pull_request_review_id":8629462,"id":88053391,"diff_hunk":"@@ -97,19 +312,28 @@ def __init__(self, conf):\n         AutomatedEmail.__init__(self, Attendee,\n                                 subject='{EVENT_NAME} Department Checklist: ' + conf.name,\n                                 template='shifts/dept_checklist.txt',\n-                                filter=lambda a: a.is_single_dept_head and a.admin_account and days_before(7, conf.deadline) and not conf.completed(a),\n+                                filter=lambda a: a.is_single_dept_head and a.admin_account and not conf.completed(a),\n+                                when=days_before(7, conf.deadline),\n                                 sender=c.STAFF_EMAIL,\n                                 extra_data={'conf': conf})\n \n-before = lambda dt: bool(dt) and localized_now() < dt\n-after = lambda dt: bool(dt) and localized_now() > dt\n-days_after = lambda days, dt: bool(dt) and (localized_now() > dt + timedelta(days=days))\n \n+\"\"\"\n+IMPORTANT NOTES:\n+\n+'ident' is a unique ID for that email category that must not change after emails in that category have started to send.\n+\n+\n+\n+#If an 'ident' is not set, 'ident' will default to be the 'subject' line.\n+#The reason you don't want this is because we keep track of which emails have been sent by their 'ident', and if the\n+\n+\n+TODO: FIXME: Going forward, every single email category below should have an explicit 'ident' set. However,\n+mid-year we can't change the idents effectively because it will cause emails in these categories to be re-sent.\n \n-def days_before(days, dt, until=None):\n-    if dt:\n-        until = (dt - timedelta(days=until)) if until else dt\n-        return dt - timedelta(days=days) < localized_now() < until\n+Guidelines for naming 'idents'","path":"uber/automated_emails.py","position":364,"original_position":364,"commit_id":"82d6871838d3eea3fd5b1dcfb36d439e3076c561","original_commit_id":"82d6871838d3eea3fd5b1dcfb36d439e3076c561","user":{"login":"kitsuta","id":7198215,"avatar_url":"https://avatars.githubusercontent.com/u/7198215?v=3","gravatar_id":"","url":"https://api.github.com/users/kitsuta","html_url":"https://github.com/kitsuta","followers_url":"https://api.github.com/users/kitsuta/followers","following_url":"https://api.github.com/users/kitsuta/following{/other_user}","gists_url":"https://api.github.com/users/kitsuta/gists{/gist_id}","starred_url":"https://api.github.com/users/kitsuta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitsuta/subscriptions","organizations_url":"https://api.github.com/users/kitsuta/orgs","repos_url":"https://api.github.com/users/kitsuta/repos","events_url":"https://api.github.com/users/kitsuta/events{/privacy}","received_events_url":"https://api.github.com/users/kitsuta/received_events","type":"User","site_admin":false},"body":"Another seemingly unfinished comment.","created_at":"2016-11-15T16:22:40Z","updated_at":"2016-11-15T16:31:06Z","html_url":"https://github.com/magfest/ubersystem/pull/1896#discussion_r88053391","pull_request_url":"https://api.github.com/repos/magfest/ubersystem/pulls/1896","_links":{"self":{"href":"https://api.github.com/repos/magfest/ubersystem/pulls/comments/88053391"},"html":{"href":"https://github.com/magfest/ubersystem/pull/1896#discussion_r88053391"},"pull_request":{"href":"https://api.github.com/repos/magfest/ubersystem/pulls/1896"}}},"pull_request":{"url":"https://api.github.com/repos/magfest/ubersystem/pulls/1896","id":76779495,"html_url":"https://github.com/magfest/ubersystem/pull/1896","diff_url":"https://github.com/magfest/ubersystem/pull/1896.diff","patch_url":"https://github.com/magfest/ubersystem/pull/1896.patch","issue_url":"https://api.github.com/repos/magfest/ubersystem/issues/1896","number":1896,"state":"open","locked":false,"title":"BIG: add automated email workflow improvements / overhaul email subsystem","user":{"login":"binary1230","id":5413064,"avatar_url":"https://avatars.githubusercontent.com/u/5413064?v=3","gravatar_id":"","url":"https://api.github.com/users/binary1230","html_url":"https://github.com/binary1230","followers_url":"https://api.github.com/users/binary1230/followers","following_url":"https://api.github.com/users/binary1230/following{/other_user}","gists_url":"https://api.github.com/users/binary1230/gists{/gist_id}","starred_url":"https://api.github.com/users/binary1230/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/binary1230/subscriptions","organizations_url":"https://api.github.com/users/binary1230/orgs","repos_url":"https://api.github.com/users/binary1230/repos","events_url":"https://api.github.com/users/binary1230/events{/privacy}","received_events_url":"https://api.github.com/users/binary1230/received_events","type":"User","site_admin":false},"body":"add automated email workflow improvements:\r\n- add construct of date_filter, which allows the UI to display date conditions. doing this in the lambda filter, like we were before, functionally does the same thing, however, if we separate it out, it means the UI can inspect and show the date conditions.\r\n- on each email sending daemon run, count the number of emails that would have been sent if they were marked approved\r\n\r\noverhaul pending emails page to:\r\n- show all email categories (not just ones that need approving)\r\n- show # of sent and queued emails\r\n- show whether an approval was automatic or manual\r\n\r\nmassively refactor the underlying email subsystem to be easier to read and write a lot of tests for it\r\n\r\nPR notes:\r\n- [ ] merge alongside a bunch of other PRs for the other plugins, which I am not creating right now to avoid pull request explosion.  the other PRs just use the date_filter construct and aren't doing anything complex.  when we're ready, I'll create that stuff.\r\n- [ ] get signoff from @kitsuta and @EliAndrewC \r\n- [ ] write unit tests for decent amount of code coverage (in progress)\r\n- [X] probably only merge this after the centralized logging PRs so that we can detect any errors easily\r\n- [ ] MIVS plugin convert automated_emails.py `when` filter\r\n- [ ] magprime plugin convert automated_emails.py to use  `when` filter\r\n- [ ] re-review this to make sure everything from #2063 is now in here correctly (seems to be)","created_at":"2016-07-08T16:32:20Z","updated_at":"2016-11-15T16:31:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75de9abad0ce43840e4dbd9c02d2b9170870d1c8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/magfest/ubersystem/pulls/1896/commits","review_comments_url":"https://api.github.com/repos/magfest/ubersystem/pulls/1896/comments","review_comment_url":"https://api.github.com/repos/magfest/ubersystem/pulls/comments{/number}","comments_url":"https://api.github.com/repos/magfest/ubersystem/issues/1896/comments","statuses_url":"https://api.github.com/repos/magfest/ubersystem/statuses/82d6871838d3eea3fd5b1dcfb36d439e3076c561","head":{"label":"magfest:approval_workflow_improvements","ref":"approval_workflow_improvements","sha":"82d6871838d3eea3fd5b1dcfb36d439e3076c561","user":{"login":"magfest","id":7840140,"avatar_url":"https://avatars.githubusercontent.com/u/7840140?v=3","gravatar_id":"","url":"https://api.github.com/users/magfest","html_url":"https://github.com/magfest","followers_url":"https://api.github.com/users/magfest/followers","following_url":"https://api.github.com/users/magfest/following{/other_user}","gists_url":"https://api.github.com/users/magfest/gists{/gist_id}","starred_url":"https://api.github.com/users/magfest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magfest/subscriptions","organizations_url":"https://api.github.com/users/magfest/orgs","repos_url":"https://api.github.com/users/magfest/repos","events_url":"https://api.github.com/users/magfest/events{/privacy}","received_events_url":"https://api.github.com/users/magfest/received_events","type":"Organization","site_admin":false},"repo":{"id":16427229,"name":"ubersystem","full_name":"magfest/ubersystem","owner":{"login":"magfest","id":7840140,"avatar_url":"https://avatars.githubusercontent.com/u/7840140?v=3","gravatar_id":"","url":"https://api.github.com/users/magfest","html_url":"https://github.com/magfest","followers_url":"https://api.github.com/users/magfest/followers","following_url":"https://api.github.com/users/magfest/following{/other_user}","gists_url":"https://api.github.com/users/magfest/gists{/gist_id}","starred_url":"https://api.github.com/users/magfest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magfest/subscriptions","organizations_url":"https://api.github.com/users/magfest/orgs","repos_url":"https://api.github.com/users/magfest/repos","events_url":"https://api.github.com/users/magfest/events{/privacy}","received_events_url":"https://api.github.com/users/magfest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/magfest/ubersystem","description":"MAGFest's Ubersystem - handles ticketing, staffing, analytics, volunteers, and tons more","fork":true,"url":"https://api.github.com/repos/magfest/ubersystem","forks_url":"https://api.github.com/repos/magfest/ubersystem/forks","keys_url":"https://api.github.com/repos/magfest/ubersystem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/magfest/ubersystem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/magfest/ubersystem/teams","hooks_url":"https://api.github.com/repos/magfest/ubersystem/hooks","issue_events_url":"https://api.github.com/repos/magfest/ubersystem/issues/events{/number}","events_url":"https://api.github.com/repos/magfest/ubersystem/events","assignees_url":"https://api.github.com/repos/magfest/ubersystem/assignees{/user}","branches_url":"https://api.github.com/repos/magfest/ubersystem/branches{/branch}","tags_url":"https://api.github.com/repos/magfest/ubersystem/tags","blobs_url":"https://api.github.com/repos/magfest/ubersystem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/magfest/ubersystem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/magfest/ubersystem/git/refs{/sha}","trees_url":"https://api.github.com/repos/magfest/ubersystem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/magfest/ubersystem/statuses/{sha}","languages_url":"https://api.github.com/repos/magfest/ubersystem/languages","stargazers_url":"https://api.github.com/repos/magfest/ubersystem/stargazers","contributors_url":"https://api.github.com/repos/magfest/ubersystem/contributors","subscribers_url":"https://api.github.com/repos/magfest/ubersystem/subscribers","subscription_url":"https://api.github.com/repos/magfest/ubersystem/subscription","commits_url":"https://api.github.com/repos/magfest/ubersystem/commits{/sha}","git_commits_url":"https://api.github.com/repos/magfest/ubersystem/git/commits{/sha}","comments_url":"https://api.github.com/repos/magfest/ubersystem/comments{/number}","issue_comment_url":"https://api.github.com/repos/magfest/ubersystem/issues/comments{/number}","contents_url":"https://api.github.com/repos/magfest/ubersystem/contents/{+path}","compare_url":"https://api.github.com/repos/magfest/ubersystem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/magfest/ubersystem/merges","archive_url":"https://api.github.com/repos/magfest/ubersystem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/magfest/ubersystem/downloads","issues_url":"https://api.github.com/repos/magfest/ubersystem/issues{/number}","pulls_url":"https://api.github.com/repos/magfest/ubersystem/pulls{/number}","milestones_url":"https://api.github.com/repos/magfest/ubersystem/milestones{/number}","notifications_url":"https://api.github.com/repos/magfest/ubersystem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/magfest/ubersystem/labels{/name}","releases_url":"https://api.github.com/repos/magfest/ubersystem/releases{/id}","deployments_url":"https://api.github.com/repos/magfest/ubersystem/deployments","created_at":"2014-02-01T02:56:25Z","updated_at":"2016-10-26T15:36:13Z","pushed_at":"2016-11-15T08:42:40Z","git_url":"git://github.com/magfest/ubersystem.git","ssh_url":"git@github.com:magfest/ubersystem.git","clone_url":"https://github.com/magfest/ubersystem.git","svn_url":"https://github.com/magfest/ubersystem","homepage":"http://magfest.org","size":62810,"stargazers_count":24,"watchers_count":24,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":330,"forks":6,"open_issues":330,"watchers":24,"default_branch":"master"}},"base":{"label":"magfest:master","ref":"master","sha":"16fc52fe22a51fe62d1b77f6489ff24728af5f4b","user":{"login":"magfest","id":7840140,"avatar_url":"https://avatars.githubusercontent.com/u/7840140?v=3","gravatar_id":"","url":"https://api.github.com/users/magfest","html_url":"https://github.com/magfest","followers_url":"https://api.github.com/users/magfest/followers","following_url":"https://api.github.com/users/magfest/following{/other_user}","gists_url":"https://api.github.com/users/magfest/gists{/gist_id}","starred_url":"https://api.github.com/users/magfest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magfest/subscriptions","organizations_url":"https://api.github.com/users/magfest/orgs","repos_url":"https://api.github.com/users/magfest/repos","events_url":"https://api.github.com/users/magfest/events{/privacy}","received_events_url":"https://api.github.com/users/magfest/received_events","type":"Organization","site_admin":false},"repo":{"id":16427229,"name":"ubersystem","full_name":"magfest/ubersystem","owner":{"login":"magfest","id":7840140,"avatar_url":"https://avatars.githubusercontent.com/u/7840140?v=3","gravatar_id":"","url":"https://api.github.com/users/magfest","html_url":"https://github.com/magfest","followers_url":"https://api.github.com/users/magfest/followers","following_url":"https://api.github.com/users/magfest/following{/other_user}","gists_url":"https://api.github.com/users/magfest/gists{/gist_id}","starred_url":"https://api.github.com/users/magfest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magfest/subscriptions","organizations_url":"https://api.github.com/users/magfest/orgs","repos_url":"https://api.github.com/users/magfest/repos","events_url":"https://api.github.com/users/magfest/events{/privacy}","received_events_url":"https://api.github.com/users/magfest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/magfest/ubersystem","description":"MAGFest's Ubersystem - handles ticketing, staffing, analytics, volunteers, and tons more","fork":true,"url":"https://api.github.com/repos/magfest/ubersystem","forks_url":"https://api.github.com/repos/magfest/ubersystem/forks","keys_url":"https://api.github.com/repos/magfest/ubersystem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/magfest/ubersystem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/magfest/ubersystem/teams","hooks_url":"https://api.github.com/repos/magfest/ubersystem/hooks","issue_events_url":"https://api.github.com/repos/magfest/ubersystem/issues/events{/number}","events_url":"https://api.github.com/repos/magfest/ubersystem/events","assignees_url":"https://api.github.com/repos/magfest/ubersystem/assignees{/user}","branches_url":"https://api.github.com/repos/magfest/ubersystem/branches{/branch}","tags_url":"https://api.github.com/repos/magfest/ubersystem/tags","blobs_url":"https://api.github.com/repos/magfest/ubersystem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/magfest/ubersystem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/magfest/ubersystem/git/refs{/sha}","trees_url":"https://api.github.com/repos/magfest/ubersystem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/magfest/ubersystem/statuses/{sha}","languages_url":"https://api.github.com/repos/magfest/ubersystem/languages","stargazers_url":"https://api.github.com/repos/magfest/ubersystem/stargazers","contributors_url":"https://api.github.com/repos/magfest/ubersystem/contributors","subscribers_url":"https://api.github.com/repos/magfest/ubersystem/subscribers","subscription_url":"https://api.github.com/repos/magfest/ubersystem/subscription","commits_url":"https://api.github.com/repos/magfest/ubersystem/commits{/sha}","git_commits_url":"https://api.github.com/repos/magfest/ubersystem/git/commits{/sha}","comments_url":"https://api.github.com/repos/magfest/ubersystem/comments{/number}","issue_comment_url":"https://api.github.com/repos/magfest/ubersystem/issues/comments{/number}","contents_url":"https://api.github.com/repos/magfest/ubersystem/contents/{+path}","compare_url":"https://api.github.com/repos/magfest/ubersystem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/magfest/ubersystem/merges","archive_url":"https://api.github.com/repos/magfest/ubersystem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/magfest/ubersystem/downloads","issues_url":"https://api.github.com/repos/magfest/ubersystem/issues{/number}","pulls_url":"https://api.github.com/repos/magfest/ubersystem/pulls{/number}","milestones_url":"https://api.github.com/repos/magfest/ubersystem/milestones{/number}","notifications_url":"https://api.github.com/repos/magfest/ubersystem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/magfest/ubersystem/labels{/name}","releases_url":"https://api.github.com/repos/magfest/ubersystem/releases{/id}","deployments_url":"https://api.github.com/repos/magfest/ubersystem/deployments","created_at":"2014-02-01T02:56:25Z","updated_at":"2016-10-26T15:36:13Z","pushed_at":"2016-11-15T08:42:40Z","git_url":"git://github.com/magfest/ubersystem.git","ssh_url":"git@github.com:magfest/ubersystem.git","clone_url":"https://github.com/magfest/ubersystem.git","svn_url":"https://github.com/magfest/ubersystem","homepage":"http://magfest.org","size":62810,"stargazers_count":24,"watchers_count":24,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":330,"forks":6,"open_issues":330,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/magfest/ubersystem/pulls/1896"},"html":{"href":"https://github.com/magfest/ubersystem/pull/1896"},"issue":{"href":"https://api.github.com/repos/magfest/ubersystem/issues/1896"},"comments":{"href":"https://api.github.com/repos/magfest/ubersystem/issues/1896/comments"},"review_comments":{"href":"https://api.github.com/repos/magfest/ubersystem/pulls/1896/comments"},"review_comment":{"href":"https://api.github.com/repos/magfest/ubersystem/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/magfest/ubersystem/pulls/1896/commits"},"statuses":{"href":"https://api.github.com/repos/magfest/ubersystem/statuses/82d6871838d3eea3fd5b1dcfb36d439e3076c561"}}}}
{"actor":{"display_login":"kitsuta"}}