{"action":"created","comment":{"url":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/comments/46473218","id":46473218,"diff_hunk":"@@ -0,0 +1,870 @@\n+(function () {\n+  // 'use strict';\n+\n+  angular\n+    .module('orchestra.project.controllers')\n+    .controller('ProjectController', ProjectController);\n+\n+  ProjectController.$inject = ['$location', '$scope', '$routeParams', '$http', '$sce',\n+                            '$compile', '$modal', '$timeout', 'dataService', 'orchestraApi'];\n+\n+  function ProjectController($location, $scope, $routeParams, $http, $sce,\n+                          $compile, $modal, $timeout, dataService, orchestraApi) {\n+    // var vm = this;\n+    vm = $scope;\n+    $scope.activate = function() {\n+      // Prevent initial animation of vis load\n+      d3.select('.project-management').style('opacity', 0);\n+      $scope.vis = new projectVis($routeParams.projectId, '.project-management .svg-wrapper');\n+      $scope.vis.update();\n+      d3.select('.project-management').transition()\n+        .delay(500)\n+        .style('opacity', 1);\n+    };\n+    $scope.activate();\n+\n+    function projectVis(projectId, parentSelector) {\n+      var vis = this;\n+\n+      vis.projectId = projectId;\n+      vis.parentContainer = d3.select(parentSelector);\n+\n+      vis.options = {\n+        'scaleHeight': 40,\n+        'barHeight': 30,\n+        'lanePadding': {'top': 30, 'bottom': 25},\n+        'marginLeft': 100,\n+        'marginRight': 10,\n+      }\n+\n+      vis.relativeTime = true;\n+      vis.scaleWidth = 1350;\n+\n+      vis.crosshair = new crosshair();\n+      vis.actions = new actions();\n+      vis.utils = new utils();\n+      vis.tasks = new tasksVis();\n+      vis.assignments = new assignmentsVis();\n+      vis.iterations = new iterationsVis();\n+\n+      var axisWrapper = vis.parentContainer\n+        .append('div')\n+        .attr('class', 'axis-wrapper')\n+\n+      axisWrapper.append('svg')\n+        .attr({\n+          'class': 'x axis',\n+          'width': vis.utils.getSvgWidth(),\n+          'height': vis.options.scaleHeight,\n+        })\n+        .style('margin-left', vis.options.marginLeft);\n+\n+      axisWrapper.append('span')\n+        .attr('class', 'x label')\n+\n+      vis.draw = function() {\n+        // vis.drawSvg();\n+        vis.setupAxis();\n+        vis.tasks.draw();\n+        vis.crosshair.draw();\n+        vis.parentContainer.style('margin-left', vis.utils.freezePaneWidth() + 'px');\n+      }\n+\n+      vis.update = function() {\n+        orchestraApi.projectManagementData(vis.projectId)\n+          .then(function(response) {\n+            vis.data = response.data;\n+            vis.prepareData();\n+            dataService.data(vis.data);\n+            vis.draw();\n+          });\n+      }\n+\n+      vis.prepareData = function() {\n+        _.each(vis.data.tasks, function(task) {\n+          _.each(task.assignments, function(assignment) {\n+            assignment.task = task;\n+            _.each(assignment.iterations, function(iteration, i) {\n+              iteration.assignment = assignment;\n+            })\n+          })\n+        })\n+\n+        var timeSortedTasks = _.toArray(vis.data.tasks).sort(function(a, b) {\n+                                return d3.ascending(a.start_datetime.toDate(), b.start_datetime.toDate());\n+                             });\n+        vis.timeSortedSlugs = _.map(timeSortedTasks, function(task) {return task.step_slug})\n+      }\n+\n+      vis.setupAxis = function() {\n+        var firstTask = vis.data.tasks[_.first(vis.timeSortedSlugs)];\n+        minDatetime = firstTask.start_datetime.toDate();\n+\n+        var taskEndTimes = _.map(vis.timeSortedSlugs,\n+                                 function(slug) {return dataService.taskEnd(dataService.taskFromKey(slug))})\n+        var maxDatetime = _.max(taskEndTimes,\n+                                function(time) {return time.toDate()}).toDate()\n+\n+        var hourInMilliseconds = 60 * 60 * 1000;\n+        var numHours = Math.ceil((maxDatetime - minDatetime) / hourInMilliseconds);\n+        maxDatetime = new Date(minDatetime.getTime() + numHours * hourInMilliseconds);\n+\n+        hourTicks = _.map(d3.range(0, numHours + 1), function(hourIndex) {\n+          return new Date(minDatetime.getTime() + hourIndex * hourInMilliseconds);\n+        })\n+\n+        vis.timeScale = d3.time.scale()\n+          .domain([minDatetime, maxDatetime])\n+          .range([0, vis.scaleWidth]);\n+\n+        var xAxis = d3.svg.axis()\n+          .scale(vis.timeScale)\n+          .tickSize(10)\n+\n+        var tickSpread = 5;\n+        var xLabelText;\n+        if (vis.relativeTime) {\n+          xAxis.tickValues(hourTicks)\n+            .tickFormat(function(d, i) {\n+              return i % tickSpread == 0 ? (d - minDatetime) / hourInMilliseconds : '';\n+            });\n+          xLabelText = 'Time (hours)'\n+        }\n+        else {\n+          xAxis.ticks(d3.time.hour, 1);\n+          var defaultFormat = vis.timeScale.tickFormat();\n+          xAxis.tickFormat(function(d, i) {\n+              return i % tickSpread == 0 ? defaultFormat(d) : '';\n+            });\n+          xLabelText = 'Time (local)'\n+        }\n+\n+        vis.parentContainer.select('.x.label')\n+          .text(xLabelText)\n+          .style('right', vis.utils.getSvgWidth() + 5 + 'px');\n+\n+        vis.parentContainer.select('.x.axis').transition().call(xAxis);\n+        d3.select('.x.axis')\n+          .attr({\n+            'width': vis.utils.getSvgWidth()\n+          })\n+      }\n+\n+      function tasksVis() {","path":"orchestra/static/orchestra/project/js/controllers.js","position":null,"original_position":153,"commit_id":"f32caf369afd342cb24832ac8050805c6a816adb","original_commit_id":"a9a5fedf1787fbd0d801f8cd3b4a9a4dc9230425","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":":white_check_mark: ","created_at":"2015-12-02T20:50:07Z","updated_at":"2015-12-02T20:50:07Z","html_url":"https://github.com/unlimitedlabs/orchestra/pull/74#discussion_r46473218","pull_request_url":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/74","_links":{"self":{"href":"https://api.github.com/repos/unlimitedlabs/orchestra/pulls/comments/46473218"},"html":{"href":"https://github.com/unlimitedlabs/orchestra/pull/74#discussion_r46473218"},"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-12-02T20:50:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4988377fd4ff0677d6f486c4a582e9335ca58d5b","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/f32caf369afd342cb24832ac8050805c6a816adb","head":{"label":"unlimitedlabs:project_management","ref":"project_management","sha":"f32caf369afd342cb24832ac8050805c6a816adb","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":"Orchestra is a system for orchestrating project teams of experts and machines.","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-29T04:19:56Z","pushed_at":"2015-12-02T01:13:03Z","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":"http://orchestra.unlimitedlabs.com/","size":4295,"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":21,"forks":13,"open_issues":21,"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":"Orchestra is a system for orchestrating project teams of experts and machines.","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-29T04:19:56Z","pushed_at":"2015-12-02T01:13:03Z","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":"http://orchestra.unlimitedlabs.com/","size":4295,"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":21,"forks":13,"open_issues":21,"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/f32caf369afd342cb24832ac8050805c6a816adb"}}}}