{"action":"created","comment":{"url":"https://api.github.com/repos/codecombat/codecombat/pulls/comments/80129217","id":80129217,"diff_hunk":"@@ -0,0 +1,392 @@\n+RootView = require 'views/core/RootView'\n+Campaigns = require 'collections/Campaigns'\n+Classroom = require 'models/Classroom'\n+Courses = require 'collections/Courses'\n+Levels = require 'collections/Levels'\n+LevelSession = require 'models/LevelSession'\n+LevelSessions = require 'collections/LevelSessions'\n+User = require 'models/User'\n+Users = require 'collections/Users'\n+CourseInstances = require 'collections/CourseInstances'\n+require 'vendor/d3'\n+# Users = require 'collections/Users'\n+# helper = require 'lib/coursesHelper'\n+# popoverTemplate = require 'templates/courses/classroom-level-popover'\n+# Prepaids = require 'collections/Prepaids'\n+# utils = require 'core/utils'\n+# CocoCollection = require 'collections/CocoCollection'\n+\n+\n+\n+module.exports = class TeacherStudentView extends RootView\n+  id: 'teacher-student-view'\n+  template: require 'templates/teachers/teacher-student-view'\n+  # helper: helper\n+  events:\n+    'click .assign-student-button': 'onClickAssignStudentButton' # this button isn't working yet\n+    'click .enroll-student-button': 'onClickEnrollStudentButton' # this button isn't working yet\n+    'change #course-dropdown': 'onChangeCourseChart'\n+\n+\n+\n+  getTitle: -> return @user?.broadName()\n+\n+  initialize: (options, classroomID, @studentID) ->\n+    @classroom = new Classroom({_id: classroomID})\n+    @listenToOnce @classroom, 'sync', @onClassroomSync\n+    @supermodel.trackRequest(@classroom.fetch())\n+\n+    @courses = new Courses()\n+    # @courses.comparator = '_id'\n+    # @courseInstances = new CocoCollection([], { url: \"/db/course_instance\", model: CourseInstance})\n+    # @courseInstances.comparator = 'courseID'\n+    # @supermodel.loadCollection(@courseInstances, { data: { classroomID: classroomID } })\n+    # @listenToOnce @courses, 'sync', @onCourseInstancesSync\n+    @supermodel.trackRequest(@courses.fetch({data: { project: 'name' }}))\n+\n+    @courseInstances = new CourseInstances()\n+    @supermodel.trackRequest @courseInstances.fetchForClassroom(classroomID)\n+\n+    @levels = new Levels()\n+    # @levels.fetchForClassroom(classroomID, {data: {project: 'name,original,practice,slug'}})\n+    # @levels.on 'add', (model) -> @_byId[model.get('original')] = model # so you can 'get' them\n+    @supermodel.trackRequest(@levels.fetchForClassroom(classroomID, {data: {project: 'name,original'}}))\n+    #\n+    # @user = new User({_id: studentID})\n+    # @supermodel.trackRequest(@user.fetch())\n+\n+    @urls = require('core/urls')\n+\n+\n+    @singleStudentLevelProgressDotTemplate = require 'templates/teachers/hovers/progress-dot-single-student-level'\n+    @levelProgressMap = {}\n+\n+    super(options)\n+\n+  onLoaded: ->\n+    if @students.loaded and not @destroyed\n+      @user = _.find(@students.models, (s)=> s.id is @studentID)\n+      @updateLastPlayedString()\n+      @updateLevelProgressMap()\n+      @updateLevelDataMap()\n+      @render()\n+    super()\n+\n+  afterRender: ->\n+    super(arguments...)\n+    $('.progress-dot, .btn-view-project-level').each (i, el) ->\n+      dot = $(el)\n+      dot.tooltip({\n+        html: true\n+        container: dot\n+      }).delegate '.tooltip', 'mousemove', ->\n+        dot.tooltip('hide')\n+\n+    # @drawLineGraph()\n+    @drawBarGraph()\n+    @onChangeCourseChart()\n+\n+\n+  onChangeCourseChart: (e)->\n+    # show() the one that's selected\n+    # console.log ((e.currentTarget).value)\n+    if (e)\n+      selected = ('#visualisation-'+((e.currentTarget).value))\n+      $(\"[id|='visualisation']\").hide()\n+      $(selected).show()\n+\n+\n+    # hide() all the others\n+\n+  drawBarGraph: ->\n+    return unless @courses.loaded and @levels.loaded and @sessions?.loaded and @levelData\n+\n+    WIDTH = 1142\n+    HEIGHT = 600\n+    MARGINS = {\n+      top: 50\n+      right: 20\n+      bottom: 50\n+      left: 70\n+    }\n+\n+    # console.log (@classroom)\n+\n+    for versionedCourse in @classroom.get('courses') ? []\n+      # this does all of the courses, logic for whether student was assigned is in corresponding jade file\n+      vis = d3.select('#visualisation-'+versionedCourse._id)\n+      courseLevelData = []\n+      for level in @levelData when level.courseID is versionedCourse._id\n+        courseLevelData.push level\n+\n+      course = _.find @courses.models, (c) => c.id is versionedCourse._id\n+\n+      levels = @classroom.getLevels({courseID: course.id}).models\n+\n+\n+      xRange = d3.scale.ordinal().rangeRoundBands([MARGINS.left, WIDTH - MARGINS.right], 0.1).domain(courseLevelData.map( (d) -> d.levelIndex))\n+      yRange = d3.scale.linear().range([HEIGHT - (MARGINS.top), MARGINS.bottom]).domain([0, d3.max(courseLevelData, (d) -> if d.class > d.student then d.class else d.student)])\n+      xAxis = d3.svg.axis().scale(xRange).tickSize(1).tickSubdivide(true)\n+      yAxis = d3.svg.axis().scale(yRange).tickSize(1).orient('left').tickSubdivide(true)\n+\n+      vis.append('svg:g').attr('class', 'x axis').attr('transform', 'translate(0,' + (HEIGHT - (MARGINS.bottom)) + ')').call xAxis\n+      vis.append('svg:g').attr('class', 'y axis').attr('transform', 'translate(' + MARGINS.left + ',0)').call yAxis\n+\n+      chart = vis.selectAll('rect')\n+      .data(courseLevelData)\n+      .enter()\n+      chart.append('rect')","path":"app/views/teachers/TeacherStudentView.coffee","position":138,"original_position":138,"commit_id":"4f28febd9c729007bcd154edc9577e1e50c76aa6","original_commit_id":"4f28febd9c729007bcd154edc9577e1e50c76aa6","user":{"login":"phoenixeliot","id":491376,"avatar_url":"https://avatars.githubusercontent.com/u/491376?v=3","gravatar_id":"","url":"https://api.github.com/users/phoenixeliot","html_url":"https://github.com/phoenixeliot","followers_url":"https://api.github.com/users/phoenixeliot/followers","following_url":"https://api.github.com/users/phoenixeliot/following{/other_user}","gists_url":"https://api.github.com/users/phoenixeliot/gists{/gist_id}","starred_url":"https://api.github.com/users/phoenixeliot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phoenixeliot/subscriptions","organizations_url":"https://api.github.com/users/phoenixeliot/orgs","repos_url":"https://api.github.com/users/phoenixeliot/repos","events_url":"https://api.github.com/users/phoenixeliot/events{/privacy}","received_events_url":"https://api.github.com/users/phoenixeliot/received_events","type":"User","site_admin":false},"body":"I'd add a line comment before each of these `append`s just saying what it's drawing.","created_at":"2016-09-22T20:28:37Z","updated_at":"2016-09-22T20:52:23Z","html_url":"https://github.com/codecombat/codecombat/pull/3939#discussion_r80129217","pull_request_url":"https://api.github.com/repos/codecombat/codecombat/pulls/3939","_links":{"self":{"href":"https://api.github.com/repos/codecombat/codecombat/pulls/comments/80129217"},"html":{"href":"https://github.com/codecombat/codecombat/pull/3939#discussion_r80129217"},"pull_request":{"href":"https://api.github.com/repos/codecombat/codecombat/pulls/3939"}}},"pull_request":{"url":"https://api.github.com/repos/codecombat/codecombat/pulls/3939","id":86373058,"html_url":"https://github.com/codecombat/codecombat/pull/3939","diff_url":"https://github.com/codecombat/codecombat/pull/3939.diff","patch_url":"https://github.com/codecombat/codecombat/pull/3939.patch","issue_url":"https://api.github.com/repos/codecombat/codecombat/issues/3939","number":3939,"state":"open","locked":false,"title":"Add Student Profile Page","user":{"login":"ryang217","id":5892619,"avatar_url":"https://avatars.githubusercontent.com/u/5892619?v=3","gravatar_id":"","url":"https://api.github.com/users/ryang217","html_url":"https://github.com/ryang217","followers_url":"https://api.github.com/users/ryang217/followers","following_url":"https://api.github.com/users/ryang217/following{/other_user}","gists_url":"https://api.github.com/users/ryang217/gists{/gist_id}","starred_url":"https://api.github.com/users/ryang217/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryang217/subscriptions","organizations_url":"https://api.github.com/users/ryang217/orgs","repos_url":"https://api.github.com/users/ryang217/repos","events_url":"https://api.github.com/users/ryang217/events{/privacy}","received_events_url":"https://api.github.com/users/ryang217/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-22T16:40:11Z","updated_at":"2016-09-22T20:52:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/codecombat/codecombat/pulls/3939/commits","review_comments_url":"https://api.github.com/repos/codecombat/codecombat/pulls/3939/comments","review_comment_url":"https://api.github.com/repos/codecombat/codecombat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codecombat/codecombat/issues/3939/comments","statuses_url":"https://api.github.com/repos/codecombat/codecombat/statuses/4f28febd9c729007bcd154edc9577e1e50c76aa6","head":{"label":"codecombat:student-profile-pages","ref":"student-profile-pages","sha":"4f28febd9c729007bcd154edc9577e1e50c76aa6","user":{"login":"codecombat","id":5795842,"avatar_url":"https://avatars.githubusercontent.com/u/5795842?v=3","gravatar_id":"","url":"https://api.github.com/users/codecombat","html_url":"https://github.com/codecombat","followers_url":"https://api.github.com/users/codecombat/followers","following_url":"https://api.github.com/users/codecombat/following{/other_user}","gists_url":"https://api.github.com/users/codecombat/gists{/gist_id}","starred_url":"https://api.github.com/users/codecombat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codecombat/subscriptions","organizations_url":"https://api.github.com/users/codecombat/orgs","repos_url":"https://api.github.com/users/codecombat/repos","events_url":"https://api.github.com/users/codecombat/events{/privacy}","received_events_url":"https://api.github.com/users/codecombat/received_events","type":"Organization","site_admin":false},"repo":{"id":15193430,"name":"codecombat","full_name":"codecombat/codecombat","owner":{"login":"codecombat","id":5795842,"avatar_url":"https://avatars.githubusercontent.com/u/5795842?v=3","gravatar_id":"","url":"https://api.github.com/users/codecombat","html_url":"https://github.com/codecombat","followers_url":"https://api.github.com/users/codecombat/followers","following_url":"https://api.github.com/users/codecombat/following{/other_user}","gists_url":"https://api.github.com/users/codecombat/gists{/gist_id}","starred_url":"https://api.github.com/users/codecombat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codecombat/subscriptions","organizations_url":"https://api.github.com/users/codecombat/orgs","repos_url":"https://api.github.com/users/codecombat/repos","events_url":"https://api.github.com/users/codecombat/events{/privacy}","received_events_url":"https://api.github.com/users/codecombat/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codecombat/codecombat","description":"Game for learning how to code.","fork":false,"url":"https://api.github.com/repos/codecombat/codecombat","forks_url":"https://api.github.com/repos/codecombat/codecombat/forks","keys_url":"https://api.github.com/repos/codecombat/codecombat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codecombat/codecombat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codecombat/codecombat/teams","hooks_url":"https://api.github.com/repos/codecombat/codecombat/hooks","issue_events_url":"https://api.github.com/repos/codecombat/codecombat/issues/events{/number}","events_url":"https://api.github.com/repos/codecombat/codecombat/events","assignees_url":"https://api.github.com/repos/codecombat/codecombat/assignees{/user}","branches_url":"https://api.github.com/repos/codecombat/codecombat/branches{/branch}","tags_url":"https://api.github.com/repos/codecombat/codecombat/tags","blobs_url":"https://api.github.com/repos/codecombat/codecombat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codecombat/codecombat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codecombat/codecombat/git/refs{/sha}","trees_url":"https://api.github.com/repos/codecombat/codecombat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codecombat/codecombat/statuses/{sha}","languages_url":"https://api.github.com/repos/codecombat/codecombat/languages","stargazers_url":"https://api.github.com/repos/codecombat/codecombat/stargazers","contributors_url":"https://api.github.com/repos/codecombat/codecombat/contributors","subscribers_url":"https://api.github.com/repos/codecombat/codecombat/subscribers","subscription_url":"https://api.github.com/repos/codecombat/codecombat/subscription","commits_url":"https://api.github.com/repos/codecombat/codecombat/commits{/sha}","git_commits_url":"https://api.github.com/repos/codecombat/codecombat/git/commits{/sha}","comments_url":"https://api.github.com/repos/codecombat/codecombat/comments{/number}","issue_comment_url":"https://api.github.com/repos/codecombat/codecombat/issues/comments{/number}","contents_url":"https://api.github.com/repos/codecombat/codecombat/contents/{+path}","compare_url":"https://api.github.com/repos/codecombat/codecombat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codecombat/codecombat/merges","archive_url":"https://api.github.com/repos/codecombat/codecombat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codecombat/codecombat/downloads","issues_url":"https://api.github.com/repos/codecombat/codecombat/issues{/number}","pulls_url":"https://api.github.com/repos/codecombat/codecombat/pulls{/number}","milestones_url":"https://api.github.com/repos/codecombat/codecombat/milestones{/number}","notifications_url":"https://api.github.com/repos/codecombat/codecombat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codecombat/codecombat/labels{/name}","releases_url":"https://api.github.com/repos/codecombat/codecombat/releases{/id}","deployments_url":"https://api.github.com/repos/codecombat/codecombat/deployments","created_at":"2013-12-14T21:47:37Z","updated_at":"2016-09-22T12:51:44Z","pushed_at":"2016-09-22T19:59:31Z","git_url":"git://github.com/codecombat/codecombat.git","ssh_url":"git@github.com:codecombat/codecombat.git","clone_url":"https://github.com/codecombat/codecombat.git","svn_url":"https://github.com/codecombat/codecombat","homepage":"http://codecombat.com","size":152404,"stargazers_count":5229,"watchers_count":5229,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2558,"mirror_url":null,"open_issues_count":298,"forks":2558,"open_issues":298,"watchers":5229,"default_branch":"master"}},"base":{"label":"codecombat:master","ref":"master","sha":"21fcc01cca1e14ce9d882112fba9f7f58535bd83","user":{"login":"codecombat","id":5795842,"avatar_url":"https://avatars.githubusercontent.com/u/5795842?v=3","gravatar_id":"","url":"https://api.github.com/users/codecombat","html_url":"https://github.com/codecombat","followers_url":"https://api.github.com/users/codecombat/followers","following_url":"https://api.github.com/users/codecombat/following{/other_user}","gists_url":"https://api.github.com/users/codecombat/gists{/gist_id}","starred_url":"https://api.github.com/users/codecombat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codecombat/subscriptions","organizations_url":"https://api.github.com/users/codecombat/orgs","repos_url":"https://api.github.com/users/codecombat/repos","events_url":"https://api.github.com/users/codecombat/events{/privacy}","received_events_url":"https://api.github.com/users/codecombat/received_events","type":"Organization","site_admin":false},"repo":{"id":15193430,"name":"codecombat","full_name":"codecombat/codecombat","owner":{"login":"codecombat","id":5795842,"avatar_url":"https://avatars.githubusercontent.com/u/5795842?v=3","gravatar_id":"","url":"https://api.github.com/users/codecombat","html_url":"https://github.com/codecombat","followers_url":"https://api.github.com/users/codecombat/followers","following_url":"https://api.github.com/users/codecombat/following{/other_user}","gists_url":"https://api.github.com/users/codecombat/gists{/gist_id}","starred_url":"https://api.github.com/users/codecombat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codecombat/subscriptions","organizations_url":"https://api.github.com/users/codecombat/orgs","repos_url":"https://api.github.com/users/codecombat/repos","events_url":"https://api.github.com/users/codecombat/events{/privacy}","received_events_url":"https://api.github.com/users/codecombat/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codecombat/codecombat","description":"Game for learning how to code.","fork":false,"url":"https://api.github.com/repos/codecombat/codecombat","forks_url":"https://api.github.com/repos/codecombat/codecombat/forks","keys_url":"https://api.github.com/repos/codecombat/codecombat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codecombat/codecombat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codecombat/codecombat/teams","hooks_url":"https://api.github.com/repos/codecombat/codecombat/hooks","issue_events_url":"https://api.github.com/repos/codecombat/codecombat/issues/events{/number}","events_url":"https://api.github.com/repos/codecombat/codecombat/events","assignees_url":"https://api.github.com/repos/codecombat/codecombat/assignees{/user}","branches_url":"https://api.github.com/repos/codecombat/codecombat/branches{/branch}","tags_url":"https://api.github.com/repos/codecombat/codecombat/tags","blobs_url":"https://api.github.com/repos/codecombat/codecombat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codecombat/codecombat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codecombat/codecombat/git/refs{/sha}","trees_url":"https://api.github.com/repos/codecombat/codecombat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codecombat/codecombat/statuses/{sha}","languages_url":"https://api.github.com/repos/codecombat/codecombat/languages","stargazers_url":"https://api.github.com/repos/codecombat/codecombat/stargazers","contributors_url":"https://api.github.com/repos/codecombat/codecombat/contributors","subscribers_url":"https://api.github.com/repos/codecombat/codecombat/subscribers","subscription_url":"https://api.github.com/repos/codecombat/codecombat/subscription","commits_url":"https://api.github.com/repos/codecombat/codecombat/commits{/sha}","git_commits_url":"https://api.github.com/repos/codecombat/codecombat/git/commits{/sha}","comments_url":"https://api.github.com/repos/codecombat/codecombat/comments{/number}","issue_comment_url":"https://api.github.com/repos/codecombat/codecombat/issues/comments{/number}","contents_url":"https://api.github.com/repos/codecombat/codecombat/contents/{+path}","compare_url":"https://api.github.com/repos/codecombat/codecombat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codecombat/codecombat/merges","archive_url":"https://api.github.com/repos/codecombat/codecombat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codecombat/codecombat/downloads","issues_url":"https://api.github.com/repos/codecombat/codecombat/issues{/number}","pulls_url":"https://api.github.com/repos/codecombat/codecombat/pulls{/number}","milestones_url":"https://api.github.com/repos/codecombat/codecombat/milestones{/number}","notifications_url":"https://api.github.com/repos/codecombat/codecombat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codecombat/codecombat/labels{/name}","releases_url":"https://api.github.com/repos/codecombat/codecombat/releases{/id}","deployments_url":"https://api.github.com/repos/codecombat/codecombat/deployments","created_at":"2013-12-14T21:47:37Z","updated_at":"2016-09-22T12:51:44Z","pushed_at":"2016-09-22T19:59:31Z","git_url":"git://github.com/codecombat/codecombat.git","ssh_url":"git@github.com:codecombat/codecombat.git","clone_url":"https://github.com/codecombat/codecombat.git","svn_url":"https://github.com/codecombat/codecombat","homepage":"http://codecombat.com","size":152404,"stargazers_count":5229,"watchers_count":5229,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2558,"mirror_url":null,"open_issues_count":298,"forks":2558,"open_issues":298,"watchers":5229,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codecombat/codecombat/pulls/3939"},"html":{"href":"https://github.com/codecombat/codecombat/pull/3939"},"issue":{"href":"https://api.github.com/repos/codecombat/codecombat/issues/3939"},"comments":{"href":"https://api.github.com/repos/codecombat/codecombat/issues/3939/comments"},"review_comments":{"href":"https://api.github.com/repos/codecombat/codecombat/pulls/3939/comments"},"review_comment":{"href":"https://api.github.com/repos/codecombat/codecombat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codecombat/codecombat/pulls/3939/commits"},"statuses":{"href":"https://api.github.com/repos/codecombat/codecombat/statuses/4f28febd9c729007bcd154edc9577e1e50c76aa6"}}}}
{"actor":{"display_login":"phoenixeliot"}}