{"action":"created","comment":{"url":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/comments/45928215","id":45928215,"diff_hunk":"@@ -183,6 +204,128 @@ def submit_task_assignment(request):\n         raise BadRequest(e)\n \n \n+@json_view\n+@login_required\n+@user_passes_test(is_project_admin)\n+def project_management_information_api(request):\n+    project_id = json.loads(request.body.decode())['project_id']\n+    df = work_time_df(Project.objects.filter(id=project_id),\n+                      human_only=False, complete_tasks_only=False,\n+                      in_progress_iterations=True)\n+    project_information = get_project_information(project_id)\n+    project_information['project']['admin_url'] = urljoin(\n+        settings.ORCHESTRA_URL,\n+        urlresolvers.reverse(\n+            'admin:orchestra_project_change',\n+            args=(project_id,)))\n+\n+    for slug, task in project_information['tasks'].items():\n+        task['admin_url'] = urljoin(\n+            settings.ORCHESTRA_URL,\n+            urlresolvers.reverse(\n+                'admin:orchestra_task_change',\n+                args=(task['id'],)))\n+\n+        for assignment in task['assignments']:\n+            assignment['admin_url'] = urljoin(\n+                settings.ORCHESTRA_URL,\n+                urlresolvers.reverse(\n+                    'admin:orchestra_taskassignment_change',\n+                    args=(assignment['id'],)))\n+\n+            iterations = df[(df.worker == assignment['worker']) &\n+                            (df.task_id == task['id'])]\n+            assignment['iterations'] = []\n+            for idx, info in iterations.T.items():\n+                iteration = info.to_dict()\n+                iteration['end_datetime'] = (\n+                    iteration['start_datetime'] + iteration['calendar_time'])\n+                del iteration['calendar_time']\n+                del iteration['work_time']\n+                assignment['iterations'].append(iteration)\n+    return project_information\n+\n+\n+@json_view\n+@login_required\n+@user_passes_test(is_project_admin)\n+def reassign_assignment_api(request):\n+    worker_username = json.loads(request.body.decode())['worker_username']\n+    worker = Worker.objects.get(user__username=worker_username)","path":"orchestra/views.py","position":113,"original_position":113,"commit_id":"a9a5fedf1787fbd0d801f8cd3b4a9a4dc9230425","original_commit_id":"a9a5fedf1787fbd0d801f8cd3b4a9a4dc9230425","user":{"login":"marcua","id":57725,"avatar_url":"https://avatars.githubusercontent.com/u/57725?v=3","gravatar_id":"","url":"https://api.github.com/users/marcua","html_url":"https://github.com/marcua","followers_url":"https://api.github.com/users/marcua/followers","following_url":"https://api.github.com/users/marcua/following{/other_user}","gists_url":"https://api.github.com/users/marcua/gists{/gist_id}","starred_url":"https://api.github.com/users/marcua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcua/subscriptions","organizations_url":"https://api.github.com/users/marcua/orgs","repos_url":"https://api.github.com/users/marcua/repos","events_url":"https://api.github.com/users/marcua/events{/privacy}","received_events_url":"https://api.github.com/users/marcua/received_events","type":"User","site_admin":false},"body":"ideally we wouldn't hit our data model in views, so even though it's a one-liner, relegate this query to a function in another module.\r\n\r\nsuper-nitpicky...","created_at":"2015-11-25T22:49:48Z","updated_at":"2015-11-25T22:49:48Z","html_url":"https://github.com/unlimitedlabs/orchestra/pull/74#discussion_r45928215","pull_request_url":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/74","_links":{"self":{"href":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/comments/45928215"},"html":{"href":"https://github.com/unlimitedlabs/orchestra/pull/74#discussion_r45928215"},"pull_request":{"href":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/74"}}},"pull_request":{"url":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/74","id":51734443,"html_url":"https://github.com/unlimitedlabs/orchestra/pull/74","diff_url":"https://github.com/unlimitedlabs/orchestra/pull/74.diff","patch_url":"https://github.com/unlimitedlabs/orchestra/pull/74.patch","issue_url":"https://api.github.com/repos/unlimitedlabs/orchestra/issues/74","number":74,"state":"open","locked":false,"title":"Implement view for visualizing and administrating projects","user":{"login":"jrbotros","id":2992765,"avatar_url":"https://avatars.githubusercontent.com/u/2992765?v=3","gravatar_id":"","url":"https://api.github.com/users/jrbotros","html_url":"https://github.com/jrbotros","followers_url":"https://api.github.com/users/jrbotros/followers","following_url":"https://api.github.com/users/jrbotros/following{/other_user}","gists_url":"https://api.github.com/users/jrbotros/gists{/gist_id}","starred_url":"https://api.github.com/users/jrbotros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrbotros/subscriptions","organizations_url":"https://api.github.com/users/jrbotros/orgs","repos_url":"https://api.github.com/users/jrbotros/repos","events_url":"https://api.github.com/users/jrbotros/events{/privacy}","received_events_url":"https://api.github.com/users/jrbotros/received_events","type":"User","site_admin":false},"body":"This view provides a visualization for project data and should allow users to circumvent the project and task admin sites for most all common actions, providing functionality for:\r\n* reverting a task to a previous state\r\n* reassigning any assignment for a given task\r\n* adding a new assignment for `AWAITING_PROCESSING` or `PENDING_REVIEW` tasks\r\n* skipping a task and marking it as complete (e.g., a machine task that hangs and prevents subsequent task creation)\r\n* adding and removing slack users from the project group\r\n* creating subsequent tasks for the project\r\n* viewing data and linking to the Django admin at all levels of granularity\r\n\r\nTo view the project management screen for any project, you'll need to be logged into a user who's been added to a `project_admins` Django group.\r\n","created_at":"2015-11-24T23:47:31Z","updated_at":"2015-11-25T22:49:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62faf4df47e66e4c6ae4490f9aa40a611590031a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/74/commits","review_comments_url":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/74/comments","review_comment_url":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/comments{/number}","comments_url":"https://api.github.com/repos/unlimitedlabs/orchestra/issues/74/comments","statuses_url":"https://api.github.com/repos/unlimitedlabs/orchestra/statuses/a9a5fedf1787fbd0d801f8cd3b4a9a4dc9230425","head":{"label":"unlimitedlabs:project_management","ref":"project_management","sha":"a9a5fedf1787fbd0d801f8cd3b4a9a4dc9230425","user":{"login":"unlimitedlabs","id":12401025,"avatar_url":"https://avatars.githubusercontent.com/u/12401025?v=3","gravatar_id":"","url":"https://api.github.com/users/unlimitedlabs","html_url":"https://github.com/unlimitedlabs","followers_url":"https://api.github.com/users/unlimitedlabs/followers","following_url":"https://api.github.com/users/unlimitedlabs/following{/other_user}","gists_url":"https://api.github.com/users/unlimitedlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/unlimitedlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unlimitedlabs/subscriptions","organizations_url":"https://api.github.com/users/unlimitedlabs/orgs","repos_url":"https://api.github.com/users/unlimitedlabs/repos","events_url":"https://api.github.com/users/unlimitedlabs/events{/privacy}","received_events_url":"https://api.github.com/users/unlimitedlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":42593972,"name":"orchestra","full_name":"unlimitedlabs/orchestra","owner":{"login":"unlimitedlabs","id":12401025,"avatar_url":"https://avatars.githubusercontent.com/u/12401025?v=3","gravatar_id":"","url":"https://api.github.com/users/unlimitedlabs","html_url":"https://github.com/unlimitedlabs","followers_url":"https://api.github.com/users/unlimitedlabs/followers","following_url":"https://api.github.com/users/unlimitedlabs/following{/other_user}","gists_url":"https://api.github.com/users/unlimitedlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/unlimitedlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unlimitedlabs/subscriptions","organizations_url":"https://api.github.com/users/unlimitedlabs/orgs","repos_url":"https://api.github.com/users/unlimitedlabs/repos","events_url":"https://api.github.com/users/unlimitedlabs/events{/privacy}","received_events_url":"https://api.github.com/users/unlimitedlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/unlimitedlabs/orchestra","description":"","fork":false,"url":"https://api.github.com/repos/unlimitedlabs/orchestra","forks_url":"https://api.github.com/repos/unlimitedlabs/orchestra/forks","keys_url":"https://api.github.com/repos/unlimitedlabs/orchestra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unlimitedlabs/orchestra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unlimitedlabs/orchestra/teams","hooks_url":"https://api.github.com/repos/unlimitedlabs/orchestra/hooks","issue_events_url":"https://api.github.com/repos/unlimitedlabs/orchestra/issues/events{/number}","events_url":"https://api.github.com/repos/unlimitedlabs/orchestra/events","assignees_url":"https://api.github.com/repos/unlimitedlabs/orchestra/assignees{/user}","branches_url":"https://api.github.com/repos/unlimitedlabs/orchestra/branches{/branch}","tags_url":"https://api.github.com/repos/unlimitedlabs/orchestra/tags","blobs_url":"https://api.github.com/repos/unlimitedlabs/orchestra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unlimitedlabs/orchestra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unlimitedlabs/orchestra/git/refs{/sha}","trees_url":"https://api.github.com/repos/unlimitedlabs/orchestra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unlimitedlabs/orchestra/statuses/{sha}","languages_url":"https://api.github.com/repos/unlimitedlabs/orchestra/languages","stargazers_url":"https://api.github.com/repos/unlimitedlabs/orchestra/stargazers","contributors_url":"https://api.github.com/repos/unlimitedlabs/orchestra/contributors","subscribers_url":"https://api.github.com/repos/unlimitedlabs/orchestra/subscribers","subscription_url":"https://api.github.com/repos/unlimitedlabs/orchestra/subscription","commits_url":"https://api.github.com/repos/unlimitedlabs/orchestra/commits{/sha}","git_commits_url":"https://api.github.com/repos/unlimitedlabs/orchestra/git/commits{/sha}","comments_url":"https://api.github.com/repos/unlimitedlabs/orchestra/comments{/number}","issue_comment_url":"https://api.github.com/repos/unlimitedlabs/orchestra/issues/comments{/number}","contents_url":"https://api.github.com/repos/unlimitedlabs/orchestra/contents/{+path}","compare_url":"https://api.github.com/repos/unlimitedlabs/orchestra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unlimitedlabs/orchestra/merges","archive_url":"https://api.github.com/repos/unlimitedlabs/orchestra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unlimitedlabs/orchestra/downloads","issues_url":"https://api.github.com/repos/unlimitedlabs/orchestra/issues{/number}","pulls_url":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls{/number}","milestones_url":"https://api.github.com/repos/unlimitedlabs/orchestra/milestones{/number}","notifications_url":"https://api.github.com/repos/unlimitedlabs/orchestra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unlimitedlabs/orchestra/labels{/name}","releases_url":"https://api.github.com/repos/unlimitedlabs/orchestra/releases{/id}","created_at":"2015-09-16T14:55:16Z","updated_at":"2015-11-25T22:44:49Z","pushed_at":"2015-11-24T23:47:31Z","git_url":"git://github.com/unlimitedlabs/orchestra.git","ssh_url":"git@github.com:unlimitedlabs/orchestra.git","clone_url":"https://github.com/unlimitedlabs/orchestra.git","svn_url":"https://github.com/unlimitedlabs/orchestra","homepage":null,"size":4156,"stargazers_count":207,"watchers_count":207,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":18,"forks":13,"open_issues":18,"watchers":207,"default_branch":"master"}},"base":{"label":"unlimitedlabs:master","ref":"master","sha":"96719faf28de0784dd2b5cffa9e491cf3be5cece","user":{"login":"unlimitedlabs","id":12401025,"avatar_url":"https://avatars.githubusercontent.com/u/12401025?v=3","gravatar_id":"","url":"https://api.github.com/users/unlimitedlabs","html_url":"https://github.com/unlimitedlabs","followers_url":"https://api.github.com/users/unlimitedlabs/followers","following_url":"https://api.github.com/users/unlimitedlabs/following{/other_user}","gists_url":"https://api.github.com/users/unlimitedlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/unlimitedlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unlimitedlabs/subscriptions","organizations_url":"https://api.github.com/users/unlimitedlabs/orgs","repos_url":"https://api.github.com/users/unlimitedlabs/repos","events_url":"https://api.github.com/users/unlimitedlabs/events{/privacy}","received_events_url":"https://api.github.com/users/unlimitedlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":42593972,"name":"orchestra","full_name":"unlimitedlabs/orchestra","owner":{"login":"unlimitedlabs","id":12401025,"avatar_url":"https://avatars.githubusercontent.com/u/12401025?v=3","gravatar_id":"","url":"https://api.github.com/users/unlimitedlabs","html_url":"https://github.com/unlimitedlabs","followers_url":"https://api.github.com/users/unlimitedlabs/followers","following_url":"https://api.github.com/users/unlimitedlabs/following{/other_user}","gists_url":"https://api.github.com/users/unlimitedlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/unlimitedlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unlimitedlabs/subscriptions","organizations_url":"https://api.github.com/users/unlimitedlabs/orgs","repos_url":"https://api.github.com/users/unlimitedlabs/repos","events_url":"https://api.github.com/users/unlimitedlabs/events{/privacy}","received_events_url":"https://api.github.com/users/unlimitedlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/unlimitedlabs/orchestra","description":"","fork":false,"url":"https://api.github.com/repos/unlimitedlabs/orchestra","forks_url":"https://api.github.com/repos/unlimitedlabs/orchestra/forks","keys_url":"https://api.github.com/repos/unlimitedlabs/orchestra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unlimitedlabs/orchestra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unlimitedlabs/orchestra/teams","hooks_url":"https://api.github.com/repos/unlimitedlabs/orchestra/hooks","issue_events_url":"https://api.github.com/repos/unlimitedlabs/orchestra/issues/events{/number}","events_url":"https://api.github.com/repos/unlimitedlabs/orchestra/events","assignees_url":"https://api.github.com/repos/unlimitedlabs/orchestra/assignees{/user}","branches_url":"https://api.github.com/repos/unlimitedlabs/orchestra/branches{/branch}","tags_url":"https://api.github.com/repos/unlimitedlabs/orchestra/tags","blobs_url":"https://api.github.com/repos/unlimitedlabs/orchestra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unlimitedlabs/orchestra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unlimitedlabs/orchestra/git/refs{/sha}","trees_url":"https://api.github.com/repos/unlimitedlabs/orchestra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unlimitedlabs/orchestra/statuses/{sha}","languages_url":"https://api.github.com/repos/unlimitedlabs/orchestra/languages","stargazers_url":"https://api.github.com/repos/unlimitedlabs/orchestra/stargazers","contributors_url":"https://api.github.com/repos/unlimitedlabs/orchestra/contributors","subscribers_url":"https://api.github.com/repos/unlimitedlabs/orchestra/subscribers","subscription_url":"https://api.github.com/repos/unlimitedlabs/orchestra/subscription","commits_url":"https://api.github.com/repos/unlimitedlabs/orchestra/commits{/sha}","git_commits_url":"https://api.github.com/repos/unlimitedlabs/orchestra/git/commits{/sha}","comments_url":"https://api.github.com/repos/unlimitedlabs/orchestra/comments{/number}","issue_comment_url":"https://api.github.com/repos/unlimitedlabs/orchestra/issues/comments{/number}","contents_url":"https://api.github.com/repos/unlimitedlabs/orchestra/contents/{+path}","compare_url":"https://api.github.com/repos/unlimitedlabs/orchestra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unlimitedlabs/orchestra/merges","archive_url":"https://api.github.com/repos/unlimitedlabs/orchestra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unlimitedlabs/orchestra/downloads","issues_url":"https://api.github.com/repos/unlimitedlabs/orchestra/issues{/number}","pulls_url":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls{/number}","milestones_url":"https://api.github.com/repos/unlimitedlabs/orchestra/milestones{/number}","notifications_url":"https://api.github.com/repos/unlimitedlabs/orchestra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unlimitedlabs/orchestra/labels{/name}","releases_url":"https://api.github.com/repos/unlimitedlabs/orchestra/releases{/id}","created_at":"2015-09-16T14:55:16Z","updated_at":"2015-11-25T22:44:49Z","pushed_at":"2015-11-24T23:47:31Z","git_url":"git://github.com/unlimitedlabs/orchestra.git","ssh_url":"git@github.com:unlimitedlabs/orchestra.git","clone_url":"https://github.com/unlimitedlabs/orchestra.git","svn_url":"https://github.com/unlimitedlabs/orchestra","homepage":null,"size":4156,"stargazers_count":207,"watchers_count":207,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":18,"forks":13,"open_issues":18,"watchers":207,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/74"},"html":{"href":"https://github.com/unlimitedlabs/orchestra/pull/74"},"issue":{"href":"https://api.github.com/repos/unlimitedlabs/orchestra/issues/74"},"comments":{"href":"https://api.github.com/repos/unlimitedlabs/orchestra/issues/74/comments"},"review_comments":{"href":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/74/comments"},"review_comment":{"href":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/74/commits"},"statuses":{"href":"https://api.github.com/repos/unlimitedlabs/orchestra/statuses/a9a5fedf1787fbd0d801f8cd3b4a9a4dc9230425"}}}}