{"action":"created","comment":{"url":"https://api.github.com/repos/attendanceproject/djattendance/pulls/comments/179930892","pull_request_review_id":110270041,"id":179930892,"diff_hunk":"@@ -0,0 +1,89 @@\n+from django.core.management.base import BaseCommand\n+from attendance.models import Roll\n+from accounts.models import Trainee\n+from terms.models import Term\n+from datetime import datetime\n+from leaveslips.models import IndividualSlip\n+\n+\n+def out(s, f):\n+  print s\n+  f.write(s)\n+\n+\n+class Command(BaseCommand):\n+  # to use: python ap/manage.py data_check_rolls --settings=ap.settings.dev\n+\n+  def _mislink_rolls(self):\n+    # Pulls all rolls that has a mislink, the event that the rolls points to does not exist in the trainee's active schedule\n+    right_now = datetime.now().strftime(\"%m%d%Y_%H%M%S\")\n+    rolls = Roll.objects.all().order_by('event__id', 'date')\n+    ct = Term.current_term()\n+    output = '{0}: {1}-- Submitted by: {2} \\n'\n+    with open('../mislink_rolls' + right_now + '.txt', 'w') as f:\n+      for r in rolls:\n+        try:\n+          schedules = r.event.schedules.all()\n+          for s in schedules:\n+            if r.trainee.id not in s.trainees.values_list('id', flat=True):\n+              out('Trainee DNM: ', f)\n+              out(output.format(str(r.id), r, r.submitted_by), f)\n+              break\n+            else:\n+              if str(ct.term_week_of_date(r.date)) not in s.weeks:\n+                out('Wrong Week: ', f)\n+                out(output.format(str(r.id), r, r.submitted_by), f)\n+                break\n+        except Exception as e:","path":"ap/attendance/management/commands/data_check_rolls.py","position":37,"original_position":37,"commit_id":"170eb95824834fdecd2342095a3a23d4370b9be5","original_commit_id":"170eb95824834fdecd2342095a3a23d4370b9be5","user":{"login":"yipingbenjaminliu","id":8671058,"avatar_url":"https://avatars0.githubusercontent.com/u/8671058?v=4","gravatar_id":"","url":"https://api.github.com/users/yipingbenjaminliu","html_url":"https://github.com/yipingbenjaminliu","followers_url":"https://api.github.com/users/yipingbenjaminliu/followers","following_url":"https://api.github.com/users/yipingbenjaminliu/following{/other_user}","gists_url":"https://api.github.com/users/yipingbenjaminliu/gists{/gist_id}","starred_url":"https://api.github.com/users/yipingbenjaminliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yipingbenjaminliu/subscriptions","organizations_url":"https://api.github.com/users/yipingbenjaminliu/orgs","repos_url":"https://api.github.com/users/yipingbenjaminliu/repos","events_url":"https://api.github.com/users/yipingbenjaminliu/events{/privacy}","received_events_url":"https://api.github.com/users/yipingbenjaminliu/received_events","type":"User","site_admin":false},"body":"also make a function that pulls possible events that the roll should be attached to by looking at the attached event's start and end time or name or event type","created_at":"2018-04-07T23:45:29Z","updated_at":"2018-04-07T23:45:39Z","html_url":"https://github.com/attendanceproject/djattendance/pull/984#discussion_r179930892","pull_request_url":"https://api.github.com/repos/attendanceproject/djattendance/pulls/984","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/attendanceproject/djattendance/pulls/comments/179930892"},"html":{"href":"https://github.com/attendanceproject/djattendance/pull/984#discussion_r179930892"},"pull_request":{"href":"https://api.github.com/repos/attendanceproject/djattendance/pulls/984"}}},"pull_request":{"url":"https://api.github.com/repos/attendanceproject/djattendance/pulls/984","id":179840672,"html_url":"https://github.com/attendanceproject/djattendance/pull/984","diff_url":"https://github.com/attendanceproject/djattendance/pull/984.diff","patch_url":"https://github.com/attendanceproject/djattendance/pull/984.patch","issue_url":"https://api.github.com/repos/attendanceproject/djattendance/issues/984","number":984,"state":"open","locked":false,"title":"Data scripts","user":{"login":"iamsitting","id":8170930,"avatar_url":"https://avatars0.githubusercontent.com/u/8170930?v=4","gravatar_id":"","url":"https://api.github.com/users/iamsitting","html_url":"https://github.com/iamsitting","followers_url":"https://api.github.com/users/iamsitting/followers","following_url":"https://api.github.com/users/iamsitting/following{/other_user}","gists_url":"https://api.github.com/users/iamsitting/gists{/gist_id}","starred_url":"https://api.github.com/users/iamsitting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamsitting/subscriptions","organizations_url":"https://api.github.com/users/iamsitting/orgs","repos_url":"https://api.github.com/users/iamsitting/repos","events_url":"https://api.github.com/users/iamsitting/events{/privacy}","received_events_url":"https://api.github.com/users/iamsitting/received_events","type":"User","site_admin":false},"body":"#983","created_at":"2018-04-06T02:21:44Z","updated_at":"2018-04-07T23:45:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4ba4348cc995bdd8d76e9e0d136bb383b6c12f34","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/attendanceproject/djattendance/pulls/984/commits","review_comments_url":"https://api.github.com/repos/attendanceproject/djattendance/pulls/984/comments","review_comment_url":"https://api.github.com/repos/attendanceproject/djattendance/pulls/comments{/number}","comments_url":"https://api.github.com/repos/attendanceproject/djattendance/issues/984/comments","statuses_url":"https://api.github.com/repos/attendanceproject/djattendance/statuses/170eb95824834fdecd2342095a3a23d4370b9be5","head":{"label":"attendanceproject:data_scripts","ref":"data_scripts","sha":"170eb95824834fdecd2342095a3a23d4370b9be5","user":{"login":"attendanceproject","id":5070936,"avatar_url":"https://avatars1.githubusercontent.com/u/5070936?v=4","gravatar_id":"","url":"https://api.github.com/users/attendanceproject","html_url":"https://github.com/attendanceproject","followers_url":"https://api.github.com/users/attendanceproject/followers","following_url":"https://api.github.com/users/attendanceproject/following{/other_user}","gists_url":"https://api.github.com/users/attendanceproject/gists{/gist_id}","starred_url":"https://api.github.com/users/attendanceproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/attendanceproject/subscriptions","organizations_url":"https://api.github.com/users/attendanceproject/orgs","repos_url":"https://api.github.com/users/attendanceproject/repos","events_url":"https://api.github.com/users/attendanceproject/events{/privacy}","received_events_url":"https://api.github.com/users/attendanceproject/received_events","type":"Organization","site_admin":false},"repo":{"id":11232995,"name":"djattendance","full_name":"attendanceproject/djattendance","owner":{"login":"attendanceproject","id":5070936,"avatar_url":"https://avatars1.githubusercontent.com/u/5070936?v=4","gravatar_id":"","url":"https://api.github.com/users/attendanceproject","html_url":"https://github.com/attendanceproject","followers_url":"https://api.github.com/users/attendanceproject/followers","following_url":"https://api.github.com/users/attendanceproject/following{/other_user}","gists_url":"https://api.github.com/users/attendanceproject/gists{/gist_id}","starred_url":"https://api.github.com/users/attendanceproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/attendanceproject/subscriptions","organizations_url":"https://api.github.com/users/attendanceproject/orgs","repos_url":"https://api.github.com/users/attendanceproject/repos","events_url":"https://api.github.com/users/attendanceproject/events{/privacy}","received_events_url":"https://api.github.com/users/attendanceproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/attendanceproject/djattendance","description":"A rewrite of the original attendance project in Python","fork":false,"url":"https://api.github.com/repos/attendanceproject/djattendance","forks_url":"https://api.github.com/repos/attendanceproject/djattendance/forks","keys_url":"https://api.github.com/repos/attendanceproject/djattendance/keys{/key_id}","collaborators_url":"https://api.github.com/repos/attendanceproject/djattendance/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/attendanceproject/djattendance/teams","hooks_url":"https://api.github.com/repos/attendanceproject/djattendance/hooks","issue_events_url":"https://api.github.com/repos/attendanceproject/djattendance/issues/events{/number}","events_url":"https://api.github.com/repos/attendanceproject/djattendance/events","assignees_url":"https://api.github.com/repos/attendanceproject/djattendance/assignees{/user}","branches_url":"https://api.github.com/repos/attendanceproject/djattendance/branches{/branch}","tags_url":"https://api.github.com/repos/attendanceproject/djattendance/tags","blobs_url":"https://api.github.com/repos/attendanceproject/djattendance/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/attendanceproject/djattendance/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/attendanceproject/djattendance/git/refs{/sha}","trees_url":"https://api.github.com/repos/attendanceproject/djattendance/git/trees{/sha}","statuses_url":"https://api.github.com/repos/attendanceproject/djattendance/statuses/{sha}","languages_url":"https://api.github.com/repos/attendanceproject/djattendance/languages","stargazers_url":"https://api.github.com/repos/attendanceproject/djattendance/stargazers","contributors_url":"https://api.github.com/repos/attendanceproject/djattendance/contributors","subscribers_url":"https://api.github.com/repos/attendanceproject/djattendance/subscribers","subscription_url":"https://api.github.com/repos/attendanceproject/djattendance/subscription","commits_url":"https://api.github.com/repos/attendanceproject/djattendance/commits{/sha}","git_commits_url":"https://api.github.com/repos/attendanceproject/djattendance/git/commits{/sha}","comments_url":"https://api.github.com/repos/attendanceproject/djattendance/comments{/number}","issue_comment_url":"https://api.github.com/repos/attendanceproject/djattendance/issues/comments{/number}","contents_url":"https://api.github.com/repos/attendanceproject/djattendance/contents/{+path}","compare_url":"https://api.github.com/repos/attendanceproject/djattendance/compare/{base}...{head}","merges_url":"https://api.github.com/repos/attendanceproject/djattendance/merges","archive_url":"https://api.github.com/repos/attendanceproject/djattendance/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/attendanceproject/djattendance/downloads","issues_url":"https://api.github.com/repos/attendanceproject/djattendance/issues{/number}","pulls_url":"https://api.github.com/repos/attendanceproject/djattendance/pulls{/number}","milestones_url":"https://api.github.com/repos/attendanceproject/djattendance/milestones{/number}","notifications_url":"https://api.github.com/repos/attendanceproject/djattendance/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/attendanceproject/djattendance/labels{/name}","releases_url":"https://api.github.com/repos/attendanceproject/djattendance/releases{/id}","deployments_url":"https://api.github.com/repos/attendanceproject/djattendance/deployments","created_at":"2013-07-07T12:16:10Z","updated_at":"2018-04-07T23:32:46Z","pushed_at":"2018-04-07T23:41:52Z","git_url":"git://github.com/attendanceproject/djattendance.git","ssh_url":"git@github.com:attendanceproject/djattendance.git","clone_url":"https://github.com/attendanceproject/djattendance.git","svn_url":"https://github.com/attendanceproject/djattendance","homepage":"","size":171014,"stargazers_count":26,"watchers_count":26,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":123,"license":null,"forks":14,"open_issues":123,"watchers":26,"default_branch":"dev"}},"base":{"label":"attendanceproject:dev","ref":"dev","sha":"30264e8f5a178f9ba25135874a72c844f701d8b1","user":{"login":"attendanceproject","id":5070936,"avatar_url":"https://avatars1.githubusercontent.com/u/5070936?v=4","gravatar_id":"","url":"https://api.github.com/users/attendanceproject","html_url":"https://github.com/attendanceproject","followers_url":"https://api.github.com/users/attendanceproject/followers","following_url":"https://api.github.com/users/attendanceproject/following{/other_user}","gists_url":"https://api.github.com/users/attendanceproject/gists{/gist_id}","starred_url":"https://api.github.com/users/attendanceproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/attendanceproject/subscriptions","organizations_url":"https://api.github.com/users/attendanceproject/orgs","repos_url":"https://api.github.com/users/attendanceproject/repos","events_url":"https://api.github.com/users/attendanceproject/events{/privacy}","received_events_url":"https://api.github.com/users/attendanceproject/received_events","type":"Organization","site_admin":false},"repo":{"id":11232995,"name":"djattendance","full_name":"attendanceproject/djattendance","owner":{"login":"attendanceproject","id":5070936,"avatar_url":"https://avatars1.githubusercontent.com/u/5070936?v=4","gravatar_id":"","url":"https://api.github.com/users/attendanceproject","html_url":"https://github.com/attendanceproject","followers_url":"https://api.github.com/users/attendanceproject/followers","following_url":"https://api.github.com/users/attendanceproject/following{/other_user}","gists_url":"https://api.github.com/users/attendanceproject/gists{/gist_id}","starred_url":"https://api.github.com/users/attendanceproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/attendanceproject/subscriptions","organizations_url":"https://api.github.com/users/attendanceproject/orgs","repos_url":"https://api.github.com/users/attendanceproject/repos","events_url":"https://api.github.com/users/attendanceproject/events{/privacy}","received_events_url":"https://api.github.com/users/attendanceproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/attendanceproject/djattendance","description":"A rewrite of the original attendance project in Python","fork":false,"url":"https://api.github.com/repos/attendanceproject/djattendance","forks_url":"https://api.github.com/repos/attendanceproject/djattendance/forks","keys_url":"https://api.github.com/repos/attendanceproject/djattendance/keys{/key_id}","collaborators_url":"https://api.github.com/repos/attendanceproject/djattendance/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/attendanceproject/djattendance/teams","hooks_url":"https://api.github.com/repos/attendanceproject/djattendance/hooks","issue_events_url":"https://api.github.com/repos/attendanceproject/djattendance/issues/events{/number}","events_url":"https://api.github.com/repos/attendanceproject/djattendance/events","assignees_url":"https://api.github.com/repos/attendanceproject/djattendance/assignees{/user}","branches_url":"https://api.github.com/repos/attendanceproject/djattendance/branches{/branch}","tags_url":"https://api.github.com/repos/attendanceproject/djattendance/tags","blobs_url":"https://api.github.com/repos/attendanceproject/djattendance/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/attendanceproject/djattendance/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/attendanceproject/djattendance/git/refs{/sha}","trees_url":"https://api.github.com/repos/attendanceproject/djattendance/git/trees{/sha}","statuses_url":"https://api.github.com/repos/attendanceproject/djattendance/statuses/{sha}","languages_url":"https://api.github.com/repos/attendanceproject/djattendance/languages","stargazers_url":"https://api.github.com/repos/attendanceproject/djattendance/stargazers","contributors_url":"https://api.github.com/repos/attendanceproject/djattendance/contributors","subscribers_url":"https://api.github.com/repos/attendanceproject/djattendance/subscribers","subscription_url":"https://api.github.com/repos/attendanceproject/djattendance/subscription","commits_url":"https://api.github.com/repos/attendanceproject/djattendance/commits{/sha}","git_commits_url":"https://api.github.com/repos/attendanceproject/djattendance/git/commits{/sha}","comments_url":"https://api.github.com/repos/attendanceproject/djattendance/comments{/number}","issue_comment_url":"https://api.github.com/repos/attendanceproject/djattendance/issues/comments{/number}","contents_url":"https://api.github.com/repos/attendanceproject/djattendance/contents/{+path}","compare_url":"https://api.github.com/repos/attendanceproject/djattendance/compare/{base}...{head}","merges_url":"https://api.github.com/repos/attendanceproject/djattendance/merges","archive_url":"https://api.github.com/repos/attendanceproject/djattendance/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/attendanceproject/djattendance/downloads","issues_url":"https://api.github.com/repos/attendanceproject/djattendance/issues{/number}","pulls_url":"https://api.github.com/repos/attendanceproject/djattendance/pulls{/number}","milestones_url":"https://api.github.com/repos/attendanceproject/djattendance/milestones{/number}","notifications_url":"https://api.github.com/repos/attendanceproject/djattendance/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/attendanceproject/djattendance/labels{/name}","releases_url":"https://api.github.com/repos/attendanceproject/djattendance/releases{/id}","deployments_url":"https://api.github.com/repos/attendanceproject/djattendance/deployments","created_at":"2013-07-07T12:16:10Z","updated_at":"2018-04-07T23:32:46Z","pushed_at":"2018-04-07T23:41:52Z","git_url":"git://github.com/attendanceproject/djattendance.git","ssh_url":"git@github.com:attendanceproject/djattendance.git","clone_url":"https://github.com/attendanceproject/djattendance.git","svn_url":"https://github.com/attendanceproject/djattendance","homepage":"","size":171014,"stargazers_count":26,"watchers_count":26,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":123,"license":null,"forks":14,"open_issues":123,"watchers":26,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/attendanceproject/djattendance/pulls/984"},"html":{"href":"https://github.com/attendanceproject/djattendance/pull/984"},"issue":{"href":"https://api.github.com/repos/attendanceproject/djattendance/issues/984"},"comments":{"href":"https://api.github.com/repos/attendanceproject/djattendance/issues/984/comments"},"review_comments":{"href":"https://api.github.com/repos/attendanceproject/djattendance/pulls/984/comments"},"review_comment":{"href":"https://api.github.com/repos/attendanceproject/djattendance/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/attendanceproject/djattendance/pulls/984/commits"},"statuses":{"href":"https://api.github.com/repos/attendanceproject/djattendance/statuses/170eb95824834fdecd2342095a3a23d4370b9be5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"yipingbenjaminliu"}}