{"action":"created","comment":{"url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls/comments/125514134","pull_request_review_id":47909732,"id":125514134,"diff_hunk":"@@ -0,0 +1,196 @@\n+import { OnInit, Component } from \"@angular/core\";\n+import { ActivatedRoute, Params } from \"@angular/router\";\n+import { StudentExamHistory } from \"../model/student-exam-history.model\";\n+import { Location } from \"@angular/common\";\n+import { URLSearchParams } from \"@angular/http\";\n+import { StudentResultsFilterState } from \"./model/student-results-filter-state.model\";\n+import { StudentHistoryExamWrapper } from \"../model/student-history-exam-wrapper.model\";\n+import { AssessmentType } from \"../../shared/enum/assessment-type.enum\";\n+\n+@Component({\n+  selector: 'student-results',\n+  templateUrl: './student-results.component.html'\n+})\n+export class StudentResultsComponent implements OnInit {\n+\n+  examHistory: StudentExamHistory;\n+  filterState: StudentResultsFilterState = new StudentResultsFilterState();\n+  examsByTypeAndSubject: Map<AssessmentType, Map<string, StudentHistoryExamWrapper[]>> = new Map();\n+  displayState: any = {};\n+\n+  get assessmentTypes(): AssessmentType[] {\n+    return Array.from(this.examsByTypeAndSubject.keys())\n+      .sort((a, b) => a - b);\n+  }\n+\n+  constructor(private route: ActivatedRoute,\n+              private location: Location) {\n+  }\n+\n+  ngOnInit(): void {\n+    this.examHistory = this.route.snapshot.data[ \"examHistory\" ];\n+    this.initializeFilter(\n+      this.examHistory.exams,\n+      this.route.snapshot.queryParams);\n+    this.applyFilter();\n+  }\n+\n+  /**\n+   * Retrieve an ordered list of subjects available for the given assessment type.\n+   *\n+   * @param type  An assessment type\n+   * @returns {Array<string>} The ordered list of subjects available\n+   */\n+  getSubjectsForType(type: AssessmentType): string[] {\n+    return Array.from(this.examsByTypeAndSubject.get(type).keys())\n+      .sort((a, b) => a.localeCompare(b));\n+  }\n+\n+  /**\n+   * Handle a filter state change.\n+   */\n+  onFilterChange(): void {\n+    this.updateRoute();\n+    this.applyFilter();\n+  }\n+\n+  isCollapsed(assessmentType: AssessmentType, subject: string): boolean {\n+    return this.displayState[assessmentType]\n+      && this.displayState[assessmentType][subject]\n+      && this.displayState[assessmentType][subject].collapsed;\n+  }\n+\n+  toggleCollapsed(assessmentType: AssessmentType, subject: string): void {\n+    this.displayState[assessmentType] = this.displayState[assessmentType] || {};\n+    this.displayState[assessmentType][subject] = this.displayState[assessmentType][subject] || {};\n+    this.displayState[assessmentType][subject].collapsed = !this.displayState[assessmentType][subject].collapsed;\n+  }\n+\n+  /**\n+   * Apply the current filter state to the exams.\n+   */\n+  private applyFilter(): void {\n+    let filteredExams: StudentHistoryExamWrapper[] = this.examHistory.exams\n+      .filter((wrapper) => this.filterExam(wrapper));\n+\n+    let examsByTypeAndSubject: Map<AssessmentType, Map<string, StudentHistoryExamWrapper[]>> = new Map();\n+    filteredExams.forEach((wrapper) => {\n+      let type: AssessmentType = wrapper.assessment.type;\n+      let subject: string = wrapper.assessment.subject;\n+      let byType: Map<string, StudentHistoryExamWrapper[]> = examsByTypeAndSubject.get(type) || new Map();\n+      let bySubject: StudentHistoryExamWrapper[] = byType.get(subject) || [];\n+      bySubject.push(wrapper);\n+      byType.set(subject, bySubject);\n+      examsByTypeAndSubject.set(type, byType);\n+    });\n+\n+    this.examsByTypeAndSubject = examsByTypeAndSubject;\n+  }\n+\n+  /**\n+   * Filter an exam by the current filter state.\n+   *\n+   * @param wrapper The exam wrapper to filter\n+   * @returns {boolean} True if the exam should be visible\n+   */\n+  private filterExam(wrapper: StudentHistoryExamWrapper): boolean {","path":"webapp/src/main/webapp/src/app/student/results/student-results.component.ts","position":96,"original_position":96,"commit_id":"b547ea13141a0722ce6a633a59eafb85191d8c58","original_commit_id":"22b099835618be8bb9cc87c2f0c2aa0bef4e018b","user":{"login":"bgsavage","id":5771116,"avatar_url":"https://avatars1.githubusercontent.com/u/5771116?v=3","gravatar_id":"","url":"https://api.github.com/users/bgsavage","html_url":"https://github.com/bgsavage","followers_url":"https://api.github.com/users/bgsavage/followers","following_url":"https://api.github.com/users/bgsavage/following{/other_user}","gists_url":"https://api.github.com/users/bgsavage/gists{/gist_id}","starred_url":"https://api.github.com/users/bgsavage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgsavage/subscriptions","organizations_url":"https://api.github.com/users/bgsavage/orgs","repos_url":"https://api.github.com/users/bgsavage/repos","events_url":"https://api.github.com/users/bgsavage/events{/privacy}","received_events_url":"https://api.github.com/users/bgsavage/received_events","type":"User","site_admin":false},"body":"nit: the name of this method should indicate the return value.  ie: `isExamVisible` .  The current name and return contradict each other.  I would think you should return true if the exam is filtered out based on `filterExam`, which is the opposite of visible.","created_at":"2017-07-04T17:38:01Z","updated_at":"2017-07-04T17:38:01Z","html_url":"https://github.com/SmarterApp/RDW_Reporting/pull/195#discussion_r125514134","pull_request_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls/195","_links":{"self":{"href":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls/comments/125514134"},"html":{"href":"https://github.com/SmarterApp/RDW_Reporting/pull/195#discussion_r125514134"},"pull_request":{"href":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls/195"}}},"pull_request":{"url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls/195","id":128833850,"html_url":"https://github.com/SmarterApp/RDW_Reporting/pull/195","diff_url":"https://github.com/SmarterApp/RDW_Reporting/pull/195.diff","patch_url":"https://github.com/SmarterApp/RDW_Reporting/pull/195.patch","issue_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/issues/195","number":195,"state":"open","locked":false,"title":"Feature/student history ui","user":{"login":"wtritch","id":617828,"avatar_url":"https://avatars0.githubusercontent.com/u/617828?v=3","gravatar_id":"","url":"https://api.github.com/users/wtritch","html_url":"https://github.com/wtritch","followers_url":"https://api.github.com/users/wtritch/followers","following_url":"https://api.github.com/users/wtritch/following{/other_user}","gists_url":"https://api.github.com/users/wtritch/gists{/gist_id}","starred_url":"https://api.github.com/users/wtritch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wtritch/subscriptions","organizations_url":"https://api.github.com/users/wtritch/orgs","repos_url":"https://api.github.com/users/wtritch/repos","events_url":"https://api.github.com/users/wtritch/events{/privacy}","received_events_url":"https://api.github.com/users/wtritch/received_events","type":"User","site_admin":false},"body":"My apologies for the stupidly-large PR.  I'll add comments below at the interesting bits.","created_at":"2017-07-04T16:20:58Z","updated_at":"2017-07-04T17:38:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2c6f933b050a9e45d7aa89754cc334c50bf7e18b","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls/195/commits","review_comments_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls/195/comments","review_comment_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/issues/195/comments","statuses_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/statuses/b547ea13141a0722ce6a633a59eafb85191d8c58","head":{"label":"SmarterApp:feature/student-history-ui","ref":"feature/student-history-ui","sha":"b547ea13141a0722ce6a633a59eafb85191d8c58","user":{"login":"SmarterApp","id":7026395,"avatar_url":"https://avatars3.githubusercontent.com/u/7026395?v=3","gravatar_id":"","url":"https://api.github.com/users/SmarterApp","html_url":"https://github.com/SmarterApp","followers_url":"https://api.github.com/users/SmarterApp/followers","following_url":"https://api.github.com/users/SmarterApp/following{/other_user}","gists_url":"https://api.github.com/users/SmarterApp/gists{/gist_id}","starred_url":"https://api.github.com/users/SmarterApp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SmarterApp/subscriptions","organizations_url":"https://api.github.com/users/SmarterApp/orgs","repos_url":"https://api.github.com/users/SmarterApp/repos","events_url":"https://api.github.com/users/SmarterApp/events{/privacy}","received_events_url":"https://api.github.com/users/SmarterApp/received_events","type":"Organization","site_admin":false},"repo":{"id":81362154,"name":"RDW_Reporting","full_name":"SmarterApp/RDW_Reporting","owner":{"login":"SmarterApp","id":7026395,"avatar_url":"https://avatars3.githubusercontent.com/u/7026395?v=3","gravatar_id":"","url":"https://api.github.com/users/SmarterApp","html_url":"https://github.com/SmarterApp","followers_url":"https://api.github.com/users/SmarterApp/followers","following_url":"https://api.github.com/users/SmarterApp/following{/other_user}","gists_url":"https://api.github.com/users/SmarterApp/gists{/gist_id}","starred_url":"https://api.github.com/users/SmarterApp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SmarterApp/subscriptions","organizations_url":"https://api.github.com/users/SmarterApp/orgs","repos_url":"https://api.github.com/users/SmarterApp/repos","events_url":"https://api.github.com/users/SmarterApp/events{/privacy}","received_events_url":"https://api.github.com/users/SmarterApp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SmarterApp/RDW_Reporting","description":"RDW reporting tier (web app, backend services, etc.)","fork":false,"url":"https://api.github.com/repos/SmarterApp/RDW_Reporting","forks_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/forks","keys_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/teams","hooks_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/hooks","issue_events_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/issues/events{/number}","events_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/events","assignees_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/assignees{/user}","branches_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/branches{/branch}","tags_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/tags","blobs_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/git/refs{/sha}","trees_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/statuses/{sha}","languages_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/languages","stargazers_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/stargazers","contributors_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/contributors","subscribers_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/subscribers","subscription_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/subscription","commits_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/commits{/sha}","git_commits_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/git/commits{/sha}","comments_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/comments{/number}","issue_comment_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/issues/comments{/number}","contents_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/contents/{+path}","compare_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/merges","archive_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/downloads","issues_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/issues{/number}","pulls_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls{/number}","milestones_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/milestones{/number}","notifications_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/labels{/name}","releases_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/releases{/id}","deployments_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/deployments","created_at":"2017-02-08T18:31:23Z","updated_at":"2017-03-27T22:25:19Z","pushed_at":"2017-07-04T17:36:19Z","git_url":"git://github.com/SmarterApp/RDW_Reporting.git","ssh_url":"git@github.com:SmarterApp/RDW_Reporting.git","clone_url":"https://github.com/SmarterApp/RDW_Reporting.git","svn_url":"https://github.com/SmarterApp/RDW_Reporting","homepage":null,"size":4638,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"develop"}},"base":{"label":"SmarterApp:develop","ref":"develop","sha":"096a1dade3161bbbf41b59a358b111e69960ca51","user":{"login":"SmarterApp","id":7026395,"avatar_url":"https://avatars3.githubusercontent.com/u/7026395?v=3","gravatar_id":"","url":"https://api.github.com/users/SmarterApp","html_url":"https://github.com/SmarterApp","followers_url":"https://api.github.com/users/SmarterApp/followers","following_url":"https://api.github.com/users/SmarterApp/following{/other_user}","gists_url":"https://api.github.com/users/SmarterApp/gists{/gist_id}","starred_url":"https://api.github.com/users/SmarterApp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SmarterApp/subscriptions","organizations_url":"https://api.github.com/users/SmarterApp/orgs","repos_url":"https://api.github.com/users/SmarterApp/repos","events_url":"https://api.github.com/users/SmarterApp/events{/privacy}","received_events_url":"https://api.github.com/users/SmarterApp/received_events","type":"Organization","site_admin":false},"repo":{"id":81362154,"name":"RDW_Reporting","full_name":"SmarterApp/RDW_Reporting","owner":{"login":"SmarterApp","id":7026395,"avatar_url":"https://avatars3.githubusercontent.com/u/7026395?v=3","gravatar_id":"","url":"https://api.github.com/users/SmarterApp","html_url":"https://github.com/SmarterApp","followers_url":"https://api.github.com/users/SmarterApp/followers","following_url":"https://api.github.com/users/SmarterApp/following{/other_user}","gists_url":"https://api.github.com/users/SmarterApp/gists{/gist_id}","starred_url":"https://api.github.com/users/SmarterApp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SmarterApp/subscriptions","organizations_url":"https://api.github.com/users/SmarterApp/orgs","repos_url":"https://api.github.com/users/SmarterApp/repos","events_url":"https://api.github.com/users/SmarterApp/events{/privacy}","received_events_url":"https://api.github.com/users/SmarterApp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SmarterApp/RDW_Reporting","description":"RDW reporting tier (web app, backend services, etc.)","fork":false,"url":"https://api.github.com/repos/SmarterApp/RDW_Reporting","forks_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/forks","keys_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/teams","hooks_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/hooks","issue_events_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/issues/events{/number}","events_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/events","assignees_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/assignees{/user}","branches_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/branches{/branch}","tags_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/tags","blobs_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/git/refs{/sha}","trees_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/statuses/{sha}","languages_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/languages","stargazers_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/stargazers","contributors_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/contributors","subscribers_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/subscribers","subscription_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/subscription","commits_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/commits{/sha}","git_commits_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/git/commits{/sha}","comments_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/comments{/number}","issue_comment_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/issues/comments{/number}","contents_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/contents/{+path}","compare_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/merges","archive_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/downloads","issues_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/issues{/number}","pulls_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls{/number}","milestones_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/milestones{/number}","notifications_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/labels{/name}","releases_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/releases{/id}","deployments_url":"https://api.github.com/repos/SmarterApp/RDW_Reporting/deployments","created_at":"2017-02-08T18:31:23Z","updated_at":"2017-03-27T22:25:19Z","pushed_at":"2017-07-04T17:36:19Z","git_url":"git://github.com/SmarterApp/RDW_Reporting.git","ssh_url":"git@github.com:SmarterApp/RDW_Reporting.git","clone_url":"https://github.com/SmarterApp/RDW_Reporting.git","svn_url":"https://github.com/SmarterApp/RDW_Reporting","homepage":null,"size":4638,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls/195"},"html":{"href":"https://github.com/SmarterApp/RDW_Reporting/pull/195"},"issue":{"href":"https://api.github.com/repos/SmarterApp/RDW_Reporting/issues/195"},"comments":{"href":"https://api.github.com/repos/SmarterApp/RDW_Reporting/issues/195/comments"},"review_comments":{"href":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls/195/comments"},"review_comment":{"href":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SmarterApp/RDW_Reporting/pulls/195/commits"},"statuses":{"href":"https://api.github.com/repos/SmarterApp/RDW_Reporting/statuses/b547ea13141a0722ce6a633a59eafb85191d8c58"}}}}
{"actor":{"display_login":"bgsavage"}}