{"action":"created","comment":{"url":"https://api.github.com/repos/labtool/labtool/pulls/comments/194233166","pull_request_review_id":127372572,"id":194233166,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDIzMzE2Ng==","diff_hunk":"@@ -88,35 +88,54 @@ export class CoursePage extends React.Component {\n    * is a teacher or student on a course.\n    */\n   render() {\n-    const createIndents = (data, siId) => {\n-      const indents = []\n+    const numberOfCodeReviews = Array.isArray(this.props.courseData.data) ? Math.max(...this.props.courseData.data.map(student => student.codeReviews.length)) : 0\n \n-      for (var i = 0; i < this.props.selectedInstance.weekAmount; i++) {\n+    const createIndents = (weeks, codeReviews, siId) => {\n+      const indents = []\n+      let i = 0\n+      for (; i < this.props.selectedInstance.weekAmount; i++) {\n         let pushattava = (\n           <Table.Cell key={i}>\n             <p>-</p>\n           </Table.Cell>\n         )\n \n-        for (var j = 0; j < data.length; j++) {\n-          if (i + 1 === data[j].weekNumber) {\n+        for (var j = 0; j < weeks.length; j++) {\n+          if (i + 1 === weeks[j].weekNumber) {\n             pushattava = (\n               <Table.Cell key={i}>\n-                <p>{data[j].points}</p>\n+                <p>{weeks[j].points}</p>\n               </Table.Cell>\n             )\n           }\n         }\n         indents.push(pushattava)\n       }\n+      let ii = 0;\n+      codeReviews.forEach(cr => {\n+        indents.push(<Table.Cell key={i + ii}>\n+            {cr.points !== null ? (<p>{cr.points}</p>) : (<p>-</p>)}\n+          </Table.Cell>)\n+        ii++\n+      })\n+      while (ii < numberOfCodeReviews) {\n+        indents.push(<Table.Cell key={i+ii}>\n+            <p>-</p>\n+          </Table.Cell>)\n+        ii++\n+      }\n       return indents\n     }\n \n     const createHeaders = () => {\n       const headers = []\n-      for (var i = 0; i < this.props.selectedInstance.weekAmount; i++) {\n+      let i = 0\n+      for (; i < this.props.selectedInstance.weekAmount; i++) {\n         headers.push(<Table.HeaderCell key={i}>Week {i + 1} </Table.HeaderCell>)\n       }\n+      for (var ii = 1; ii <= numberOfCodeReviews; ii++) {","path":"labtool2.0/src/components/pages/CoursePage.js","position":56,"original_position":56,"commit_id":"5638005f6473f245c92dc41a233fb482bd8170e2","original_commit_id":"5638005f6473f245c92dc41a233fb482bd8170e2","user":{"login":"ootee","id":22520638,"node_id":"MDQ6VXNlcjIyNTIwNjM4","avatar_url":"https://avatars1.githubusercontent.com/u/22520638?v=4","gravatar_id":"","url":"https://api.github.com/users/ootee","html_url":"https://github.com/ootee","followers_url":"https://api.github.com/users/ootee/followers","following_url":"https://api.github.com/users/ootee/following{/other_user}","gists_url":"https://api.github.com/users/ootee/gists{/gist_id}","starred_url":"https://api.github.com/users/ootee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ootee/subscriptions","organizations_url":"https://api.github.com/users/ootee/orgs","repos_url":"https://api.github.com/users/ootee/repos","events_url":"https://api.github.com/users/ootee/events{/privacy}","received_events_url":"https://api.github.com/users/ootee/received_events","type":"User","site_admin":false},"body":"Should maybe use let in here also.","created_at":"2018-06-09T16:45:33Z","updated_at":"2018-06-09T16:45:33Z","html_url":"https://github.com/labtool/labtool/pull/357#discussion_r194233166","pull_request_url":"https://api.github.com/repos/labtool/labtool/pulls/357","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/labtool/labtool/pulls/comments/194233166"},"html":{"href":"https://github.com/labtool/labtool/pull/357#discussion_r194233166"},"pull_request":{"href":"https://api.github.com/repos/labtool/labtool/pulls/357"}}},"pull_request":{"url":"https://api.github.com/repos/labtool/labtool/pulls/357","id":193741764,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzNzQxNzY0","html_url":"https://github.com/labtool/labtool/pull/357","diff_url":"https://github.com/labtool/labtool/pull/357.diff","patch_url":"https://github.com/labtool/labtool/pull/357.patch","issue_url":"https://api.github.com/repos/labtool/labtool/issues/357","number":357,"state":"open","locked":false,"title":"Code review grading","user":{"login":"Chamion","id":22522302,"node_id":"MDQ6VXNlcjIyNTIyMzAy","avatar_url":"https://avatars0.githubusercontent.com/u/22522302?v=4","gravatar_id":"","url":"https://api.github.com/users/Chamion","html_url":"https://github.com/Chamion","followers_url":"https://api.github.com/users/Chamion/followers","following_url":"https://api.github.com/users/Chamion/following{/other_user}","gists_url":"https://api.github.com/users/Chamion/gists{/gist_id}","starred_url":"https://api.github.com/users/Chamion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chamion/subscriptions","organizations_url":"https://api.github.com/users/Chamion/orgs","repos_url":"https://api.github.com/users/Chamion/repos","events_url":"https://api.github.com/users/Chamion/events{/privacy}","received_events_url":"https://api.github.com/users/Chamion/received_events","type":"User","site_admin":false},"body":"### Short description\r\n<!-- Write a small description of what this Pull Request fixes or provides, including the issue #s -->\r\nAllow teacher to see code reviews on CoursePage. Allow teachers to grade code reviews from BrowseReviews. Added backend api route /api/codereviews/grade\r\n\r\n### DoD\r\n<!-- please indicate if any of these things are done/included with this Pull Request. Not all boxes need to be checked for the Pull Request to be accepted -->\r\nI have:\r\n- [X] added actual code.\r\n- [ ] produced clean code.\r\n- [ ] code that actually does what it should.\r\n- [ ] documented the code or added documentation to the wiki.\r\n- [ ] added or modified test(s).\r\n- [ ] test(s) that actually pass.\r\n","created_at":"2018-06-08T23:10:24Z","updated_at":"2018-06-09T16:45:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d4d1cbd7836ca97a95d924613bc94d6dd2963f0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/labtool/labtool/pulls/357/commits","review_comments_url":"https://api.github.com/repos/labtool/labtool/pulls/357/comments","review_comment_url":"https://api.github.com/repos/labtool/labtool/pulls/comments{/number}","comments_url":"https://api.github.com/repos/labtool/labtool/issues/357/comments","statuses_url":"https://api.github.com/repos/labtool/labtool/statuses/5638005f6473f245c92dc41a233fb482bd8170e2","head":{"label":"labtool:code-review-grading","ref":"code-review-grading","sha":"5638005f6473f245c92dc41a233fb482bd8170e2","user":{"login":"labtool","id":35449840,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NDQ5ODQw","avatar_url":"https://avatars2.githubusercontent.com/u/35449840?v=4","gravatar_id":"","url":"https://api.github.com/users/labtool","html_url":"https://github.com/labtool","followers_url":"https://api.github.com/users/labtool/followers","following_url":"https://api.github.com/users/labtool/following{/other_user}","gists_url":"https://api.github.com/users/labtool/gists{/gist_id}","starred_url":"https://api.github.com/users/labtool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/labtool/subscriptions","organizations_url":"https://api.github.com/users/labtool/orgs","repos_url":"https://api.github.com/users/labtool/repos","events_url":"https://api.github.com/users/labtool/events{/privacy}","received_events_url":"https://api.github.com/users/labtool/received_events","type":"Organization","site_admin":false},"repo":{"id":117524930,"node_id":"MDEwOlJlcG9zaXRvcnkxMTc1MjQ5MzA=","name":"labtool","full_name":"labtool/labtool","owner":{"login":"labtool","id":35449840,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NDQ5ODQw","avatar_url":"https://avatars2.githubusercontent.com/u/35449840?v=4","gravatar_id":"","url":"https://api.github.com/users/labtool","html_url":"https://github.com/labtool","followers_url":"https://api.github.com/users/labtool/followers","following_url":"https://api.github.com/users/labtool/following{/other_user}","gists_url":"https://api.github.com/users/labtool/gists{/gist_id}","starred_url":"https://api.github.com/users/labtool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/labtool/subscriptions","organizations_url":"https://api.github.com/users/labtool/orgs","repos_url":"https://api.github.com/users/labtool/repos","events_url":"https://api.github.com/users/labtool/events{/privacy}","received_events_url":"https://api.github.com/users/labtool/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/labtool/labtool","description":null,"fork":false,"url":"https://api.github.com/repos/labtool/labtool","forks_url":"https://api.github.com/repos/labtool/labtool/forks","keys_url":"https://api.github.com/repos/labtool/labtool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/labtool/labtool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/labtool/labtool/teams","hooks_url":"https://api.github.com/repos/labtool/labtool/hooks","issue_events_url":"https://api.github.com/repos/labtool/labtool/issues/events{/number}","events_url":"https://api.github.com/repos/labtool/labtool/events","assignees_url":"https://api.github.com/repos/labtool/labtool/assignees{/user}","branches_url":"https://api.github.com/repos/labtool/labtool/branches{/branch}","tags_url":"https://api.github.com/repos/labtool/labtool/tags","blobs_url":"https://api.github.com/repos/labtool/labtool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/labtool/labtool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/labtool/labtool/git/refs{/sha}","trees_url":"https://api.github.com/repos/labtool/labtool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/labtool/labtool/statuses/{sha}","languages_url":"https://api.github.com/repos/labtool/labtool/languages","stargazers_url":"https://api.github.com/repos/labtool/labtool/stargazers","contributors_url":"https://api.github.com/repos/labtool/labtool/contributors","subscribers_url":"https://api.github.com/repos/labtool/labtool/subscribers","subscription_url":"https://api.github.com/repos/labtool/labtool/subscription","commits_url":"https://api.github.com/repos/labtool/labtool/commits{/sha}","git_commits_url":"https://api.github.com/repos/labtool/labtool/git/commits{/sha}","comments_url":"https://api.github.com/repos/labtool/labtool/comments{/number}","issue_comment_url":"https://api.github.com/repos/labtool/labtool/issues/comments{/number}","contents_url":"https://api.github.com/repos/labtool/labtool/contents/{+path}","compare_url":"https://api.github.com/repos/labtool/labtool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/labtool/labtool/merges","archive_url":"https://api.github.com/repos/labtool/labtool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/labtool/labtool/downloads","issues_url":"https://api.github.com/repos/labtool/labtool/issues{/number}","pulls_url":"https://api.github.com/repos/labtool/labtool/pulls{/number}","milestones_url":"https://api.github.com/repos/labtool/labtool/milestones{/number}","notifications_url":"https://api.github.com/repos/labtool/labtool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/labtool/labtool/labels{/name}","releases_url":"https://api.github.com/repos/labtool/labtool/releases{/id}","deployments_url":"https://api.github.com/repos/labtool/labtool/deployments","created_at":"2018-01-15T09:30:19Z","updated_at":"2018-06-04T21:25:38Z","pushed_at":"2018-06-09T09:18:11Z","git_url":"git://github.com/labtool/labtool.git","ssh_url":"git@github.com:labtool/labtool.git","clone_url":"https://github.com/labtool/labtool.git","svn_url":"https://github.com/labtool/labtool","homepage":null,"size":6020,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":74,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":74,"watchers":0,"default_branch":"master"}},"base":{"label":"labtool:dev","ref":"dev","sha":"cff2cea793ba850366d7b0da9f6bf8c0b8016173","user":{"login":"labtool","id":35449840,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NDQ5ODQw","avatar_url":"https://avatars2.githubusercontent.com/u/35449840?v=4","gravatar_id":"","url":"https://api.github.com/users/labtool","html_url":"https://github.com/labtool","followers_url":"https://api.github.com/users/labtool/followers","following_url":"https://api.github.com/users/labtool/following{/other_user}","gists_url":"https://api.github.com/users/labtool/gists{/gist_id}","starred_url":"https://api.github.com/users/labtool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/labtool/subscriptions","organizations_url":"https://api.github.com/users/labtool/orgs","repos_url":"https://api.github.com/users/labtool/repos","events_url":"https://api.github.com/users/labtool/events{/privacy}","received_events_url":"https://api.github.com/users/labtool/received_events","type":"Organization","site_admin":false},"repo":{"id":117524930,"node_id":"MDEwOlJlcG9zaXRvcnkxMTc1MjQ5MzA=","name":"labtool","full_name":"labtool/labtool","owner":{"login":"labtool","id":35449840,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NDQ5ODQw","avatar_url":"https://avatars2.githubusercontent.com/u/35449840?v=4","gravatar_id":"","url":"https://api.github.com/users/labtool","html_url":"https://github.com/labtool","followers_url":"https://api.github.com/users/labtool/followers","following_url":"https://api.github.com/users/labtool/following{/other_user}","gists_url":"https://api.github.com/users/labtool/gists{/gist_id}","starred_url":"https://api.github.com/users/labtool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/labtool/subscriptions","organizations_url":"https://api.github.com/users/labtool/orgs","repos_url":"https://api.github.com/users/labtool/repos","events_url":"https://api.github.com/users/labtool/events{/privacy}","received_events_url":"https://api.github.com/users/labtool/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/labtool/labtool","description":null,"fork":false,"url":"https://api.github.com/repos/labtool/labtool","forks_url":"https://api.github.com/repos/labtool/labtool/forks","keys_url":"https://api.github.com/repos/labtool/labtool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/labtool/labtool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/labtool/labtool/teams","hooks_url":"https://api.github.com/repos/labtool/labtool/hooks","issue_events_url":"https://api.github.com/repos/labtool/labtool/issues/events{/number}","events_url":"https://api.github.com/repos/labtool/labtool/events","assignees_url":"https://api.github.com/repos/labtool/labtool/assignees{/user}","branches_url":"https://api.github.com/repos/labtool/labtool/branches{/branch}","tags_url":"https://api.github.com/repos/labtool/labtool/tags","blobs_url":"https://api.github.com/repos/labtool/labtool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/labtool/labtool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/labtool/labtool/git/refs{/sha}","trees_url":"https://api.github.com/repos/labtool/labtool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/labtool/labtool/statuses/{sha}","languages_url":"https://api.github.com/repos/labtool/labtool/languages","stargazers_url":"https://api.github.com/repos/labtool/labtool/stargazers","contributors_url":"https://api.github.com/repos/labtool/labtool/contributors","subscribers_url":"https://api.github.com/repos/labtool/labtool/subscribers","subscription_url":"https://api.github.com/repos/labtool/labtool/subscription","commits_url":"https://api.github.com/repos/labtool/labtool/commits{/sha}","git_commits_url":"https://api.github.com/repos/labtool/labtool/git/commits{/sha}","comments_url":"https://api.github.com/repos/labtool/labtool/comments{/number}","issue_comment_url":"https://api.github.com/repos/labtool/labtool/issues/comments{/number}","contents_url":"https://api.github.com/repos/labtool/labtool/contents/{+path}","compare_url":"https://api.github.com/repos/labtool/labtool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/labtool/labtool/merges","archive_url":"https://api.github.com/repos/labtool/labtool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/labtool/labtool/downloads","issues_url":"https://api.github.com/repos/labtool/labtool/issues{/number}","pulls_url":"https://api.github.com/repos/labtool/labtool/pulls{/number}","milestones_url":"https://api.github.com/repos/labtool/labtool/milestones{/number}","notifications_url":"https://api.github.com/repos/labtool/labtool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/labtool/labtool/labels{/name}","releases_url":"https://api.github.com/repos/labtool/labtool/releases{/id}","deployments_url":"https://api.github.com/repos/labtool/labtool/deployments","created_at":"2018-01-15T09:30:19Z","updated_at":"2018-06-04T21:25:38Z","pushed_at":"2018-06-09T09:18:11Z","git_url":"git://github.com/labtool/labtool.git","ssh_url":"git@github.com:labtool/labtool.git","clone_url":"https://github.com/labtool/labtool.git","svn_url":"https://github.com/labtool/labtool","homepage":null,"size":6020,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":74,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":74,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/labtool/labtool/pulls/357"},"html":{"href":"https://github.com/labtool/labtool/pull/357"},"issue":{"href":"https://api.github.com/repos/labtool/labtool/issues/357"},"comments":{"href":"https://api.github.com/repos/labtool/labtool/issues/357/comments"},"review_comments":{"href":"https://api.github.com/repos/labtool/labtool/pulls/357/comments"},"review_comment":{"href":"https://api.github.com/repos/labtool/labtool/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/labtool/labtool/pulls/357/commits"},"statuses":{"href":"https://api.github.com/repos/labtool/labtool/statuses/5638005f6473f245c92dc41a233fb482bd8170e2"}},"author_association":"NONE"}}
{"actor":{"display_login":"ootee"}}