{"action":"created","comment":{"url":"https://api.github.com/repos/TEAMMATES/repo/pulls/comments/35959903","id":35959903,"diff_hunk":"@@ -25,94 +55,1315 @@\n     public String groupByTeam = null;\n     public String showStats = null;\n     public int startIndex;\n+    private boolean isPanelsCollapsed;\n+    \n+    private FieldValidator validator = new FieldValidator();\n \n     // used for html table ajax loading\n     public String courseId = null;\n     public String feedbackSessionName = null;\n     public String ajaxStatus = null;\n     public String sessionResultsHtmlTableAsString = null;\n+    \n \n+    // for question view\n+    List<InstructorFeedbackResultsQuestionTable> questionPanels;\n+    // for giver > question > recipient, recipient > question > giver...\n+    LinkedHashMap<String, InstructorFeedbackResultsSectionPanel> sectionPanels;\n+    \n+    // TODO multiple page data classes inheriting this for each view type, \n+    // rather than an enum determining behavior in many methods\n+    ViewType viewType;\n+    enum ViewType {\n+        QUESTION, GIVER_QUESTION_RECIPIENT, RECIPIENT_QUESTION_GIVER;\n+        \n+        public String toString() {\n+            // replace _ to - to keep it consistent with old behavior\n+            return name().toLowerCase().replaceAll(\"_\", \"-\");\n+        }\n+        \n+        public boolean isFirstGroupedByGiver() {\n+            return this == GIVER_QUESTION_RECIPIENT;\n+        }\n+    }\n+    \n+    \n     public InstructorFeedbackResultsPageData(AccountAttributes account) {\n         super(account);\n         startIndex = -1;\n     }\n+    \n+    public void initForViewByQuestion(InstructorAttributes instructor, \n+                                      String selectedSection, String showStats, \n+                                      String groupByTeam) {\n+        viewType = ViewType.QUESTION;\n+        \n+        this.instructor = instructor;\n+        this.selectedSection = selectedSection;\n+        this.showStats = showStats;\n+        this.groupByTeam = groupByTeam;\n+        \n+        Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> questionToResponseMap = bundle.getQuestionResponseMap();\n+        questionPanels = new ArrayList<InstructorFeedbackResultsQuestionTable>();\n+        \n+        for (Map.Entry<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> entry : questionToResponseMap.entrySet()) {\n+            FeedbackQuestionAttributes question = entry.getKey();\n+            List<FeedbackResponseAttributes> responses = entry.getValue();\n+            \n+            questionPanels.add(buildQuestionTableAndResponseRows(question, responses, \"\"));\n+        }\n+        \n+    }\n+    \n+    /**\n+     * Creates {@code InstructorFeedbackResultsSectionPanel}s for sectionPanels.\n+     * \n+     * Iterates through the responses and creates panels and questions for them. Keeps track \n+     * of missing sections, teams and participants who do not have responses \n+     * and create panels for these missing sections, teams and participants.\n+     * \n+     * TODO: simplify the logic in this method\n+     */\n+    public void initForViewByGiverQuestionRecipient(InstructorAttributes instructor, \n+                                                    String selectedSection, String showStats, \n+                                                    String groupByTeam) {\n+        this.instructor = instructor;\n+        this.selectedSection = selectedSection;\n+        this.showStats = showStats;\n+        this.groupByTeam = groupByTeam;\n+        \n+        if (!bundle.isComplete) {\n+            // results page to be loaded by ajax instead \n+            if (isAllSectionsSelected()) {\n+                buildSectionPanelsForForAjaxLoading(sections);\n+            } else {\n+                buildSectionPanelWithErrorMessage();\n+            }\n+            \n+            return;\n+        }\n+        \n+        // Note that if the page needs to load by ajax, then responses will be empty too,\n+        // therefore the check whether the bundle needs to come before this\n+        if (bundle.responses.isEmpty()) {\n+            // no responses, nothing to initialize\n+            return;\n+        }\n+        \n+        setShouldCollapsed(bundle.responses.size() > RESPONSE_LIMIT_FOR_COLLAPSING_PANEL);\n+        \n+        Map<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>> sortedResponses \n+                     = bundle.getResponsesSortedByGiverQuestionRecipient(true);","path":"src/main/java/teammates/ui/controller/InstructorFeedbackResultsPageData.java","position":157,"original_position":157,"commit_id":"cfd5a993f111af5c2c64c8e632b563c3bacba495","original_commit_id":"b574ee70781d7976880f1061a26285f8fbb07e3f","user":{"login":"yj-soh","id":8586080,"avatar_url":"https://avatars.githubusercontent.com/u/8586080?v=3","gravatar_id":"","url":"https://api.github.com/users/yj-soh","html_url":"https://github.com/yj-soh","followers_url":"https://api.github.com/users/yj-soh/followers","following_url":"https://api.github.com/users/yj-soh/following{/other_user}","gists_url":"https://api.github.com/users/yj-soh/gists{/gist_id}","starred_url":"https://api.github.com/users/yj-soh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yj-soh/subscriptions","organizations_url":"https://api.github.com/users/yj-soh/orgs","repos_url":"https://api.github.com/users/yj-soh/repos","events_url":"https://api.github.com/users/yj-soh/events{/privacy}","received_events_url":"https://api.github.com/users/yj-soh/received_events","type":"User","site_admin":false},"body":"I think we're supposed to have `=` on the previous line instead?","created_at":"2015-07-31T09:43:46Z","updated_at":"2015-07-31T09:43:47Z","html_url":"https://github.com/TEAMMATES/repo/pull/3945#discussion_r35959903","pull_request_url":"https://api.github.com/repos/TEAMMATES/repo/pulls/3945","_links":{"self":{"href":"https://api.github.com/repos/TEAMMATES/repo/pulls/comments/35959903"},"html":{"href":"https://github.com/TEAMMATES/repo/pull/3945#discussion_r35959903"},"pull_request":{"href":"https://api.github.com/repos/TEAMMATES/repo/pulls/3945"}}},"pull_request":{"url":"https://api.github.com/repos/TEAMMATES/repo/pulls/3945","id":39656558,"html_url":"https://github.com/TEAMMATES/repo/pull/3945","diff_url":"https://github.com/TEAMMATES/repo/pull/3945.diff","patch_url":"https://github.com/TEAMMATES/repo/pull/3945.patch","issue_url":"https://api.github.com/repos/TEAMMATES/repo/issues/3945","number":3945,"state":"open","locked":false,"title":"JSTL - instructor feedback results","user":{"login":"kanghj","id":2216119,"avatar_url":"https://avatars.githubusercontent.com/u/2216119?v=3","gravatar_id":"","url":"https://api.github.com/users/kanghj","html_url":"https://github.com/kanghj","followers_url":"https://api.github.com/users/kanghj/followers","following_url":"https://api.github.com/users/kanghj/following{/other_user}","gists_url":"https://api.github.com/users/kanghj/gists{/gist_id}","starred_url":"https://api.github.com/users/kanghj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kanghj/subscriptions","organizations_url":"https://api.github.com/users/kanghj/orgs","repos_url":"https://api.github.com/users/kanghj/repos","events_url":"https://api.github.com/users/kanghj/events{/privacy}","received_events_url":"https://api.github.com/users/kanghj/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-10T06:45:43Z","updated_at":"2015-07-31T09:43:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d621ee96a3358e52d59bfd5bfce889cc683049e0","assignee":{"login":"yj-soh","id":8586080,"avatar_url":"https://avatars.githubusercontent.com/u/8586080?v=3","gravatar_id":"","url":"https://api.github.com/users/yj-soh","html_url":"https://github.com/yj-soh","followers_url":"https://api.github.com/users/yj-soh/followers","following_url":"https://api.github.com/users/yj-soh/following{/other_user}","gists_url":"https://api.github.com/users/yj-soh/gists{/gist_id}","starred_url":"https://api.github.com/users/yj-soh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yj-soh/subscriptions","organizations_url":"https://api.github.com/users/yj-soh/orgs","repos_url":"https://api.github.com/users/yj-soh/repos","events_url":"https://api.github.com/users/yj-soh/events{/privacy}","received_events_url":"https://api.github.com/users/yj-soh/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/TEAMMATES/repo/pulls/3945/commits","review_comments_url":"https://api.github.com/repos/TEAMMATES/repo/pulls/3945/comments","review_comment_url":"https://api.github.com/repos/TEAMMATES/repo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TEAMMATES/repo/issues/3945/comments","statuses_url":"https://api.github.com/repos/TEAMMATES/repo/statuses/cfd5a993f111af5c2c64c8e632b563c3bacba495","head":{"label":"TEAMMATES:JSTL-InstructorFeedbackResults","ref":"JSTL-InstructorFeedbackResults","sha":"cfd5a993f111af5c2c64c8e632b563c3bacba495","user":{"login":"TEAMMATES","id":7374810,"avatar_url":"https://avatars.githubusercontent.com/u/7374810?v=3","gravatar_id":"","url":"https://api.github.com/users/TEAMMATES","html_url":"https://github.com/TEAMMATES","followers_url":"https://api.github.com/users/TEAMMATES/followers","following_url":"https://api.github.com/users/TEAMMATES/following{/other_user}","gists_url":"https://api.github.com/users/TEAMMATES/gists{/gist_id}","starred_url":"https://api.github.com/users/TEAMMATES/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TEAMMATES/subscriptions","organizations_url":"https://api.github.com/users/TEAMMATES/orgs","repos_url":"https://api.github.com/users/TEAMMATES/repos","events_url":"https://api.github.com/users/TEAMMATES/events{/privacy}","received_events_url":"https://api.github.com/users/TEAMMATES/received_events","type":"Organization","site_admin":false},"repo":{"id":19369035,"name":"repo","full_name":"TEAMMATES/repo","owner":{"login":"TEAMMATES","id":7374810,"avatar_url":"https://avatars.githubusercontent.com/u/7374810?v=3","gravatar_id":"","url":"https://api.github.com/users/TEAMMATES","html_url":"https://github.com/TEAMMATES","followers_url":"https://api.github.com/users/TEAMMATES/followers","following_url":"https://api.github.com/users/TEAMMATES/following{/other_user}","gists_url":"https://api.github.com/users/TEAMMATES/gists{/gist_id}","starred_url":"https://api.github.com/users/TEAMMATES/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TEAMMATES/subscriptions","organizations_url":"https://api.github.com/users/TEAMMATES/orgs","repos_url":"https://api.github.com/users/TEAMMATES/repos","events_url":"https://api.github.com/users/TEAMMATES/events{/privacy}","received_events_url":"https://api.github.com/users/TEAMMATES/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TEAMMATES/repo","description":"This is the project website for the TEAMMATES feedback management tool for education","fork":false,"url":"https://api.github.com/repos/TEAMMATES/repo","forks_url":"https://api.github.com/repos/TEAMMATES/repo/forks","keys_url":"https://api.github.com/repos/TEAMMATES/repo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TEAMMATES/repo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TEAMMATES/repo/teams","hooks_url":"https://api.github.com/repos/TEAMMATES/repo/hooks","issue_events_url":"https://api.github.com/repos/TEAMMATES/repo/issues/events{/number}","events_url":"https://api.github.com/repos/TEAMMATES/repo/events","assignees_url":"https://api.github.com/repos/TEAMMATES/repo/assignees{/user}","branches_url":"https://api.github.com/repos/TEAMMATES/repo/branches{/branch}","tags_url":"https://api.github.com/repos/TEAMMATES/repo/tags","blobs_url":"https://api.github.com/repos/TEAMMATES/repo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TEAMMATES/repo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TEAMMATES/repo/git/refs{/sha}","trees_url":"https://api.github.com/repos/TEAMMATES/repo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TEAMMATES/repo/statuses/{sha}","languages_url":"https://api.github.com/repos/TEAMMATES/repo/languages","stargazers_url":"https://api.github.com/repos/TEAMMATES/repo/stargazers","contributors_url":"https://api.github.com/repos/TEAMMATES/repo/contributors","subscribers_url":"https://api.github.com/repos/TEAMMATES/repo/subscribers","subscription_url":"https://api.github.com/repos/TEAMMATES/repo/subscription","commits_url":"https://api.github.com/repos/TEAMMATES/repo/commits{/sha}","git_commits_url":"https://api.github.com/repos/TEAMMATES/repo/git/commits{/sha}","comments_url":"https://api.github.com/repos/TEAMMATES/repo/comments{/number}","issue_comment_url":"https://api.github.com/repos/TEAMMATES/repo/issues/comments{/number}","contents_url":"https://api.github.com/repos/TEAMMATES/repo/contents/{+path}","compare_url":"https://api.github.com/repos/TEAMMATES/repo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TEAMMATES/repo/merges","archive_url":"https://api.github.com/repos/TEAMMATES/repo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TEAMMATES/repo/downloads","issues_url":"https://api.github.com/repos/TEAMMATES/repo/issues{/number}","pulls_url":"https://api.github.com/repos/TEAMMATES/repo/pulls{/number}","milestones_url":"https://api.github.com/repos/TEAMMATES/repo/milestones{/number}","notifications_url":"https://api.github.com/repos/TEAMMATES/repo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TEAMMATES/repo/labels{/name}","releases_url":"https://api.github.com/repos/TEAMMATES/repo/releases{/id}","created_at":"2014-05-02T07:43:00Z","updated_at":"2015-07-16T06:13:09Z","pushed_at":"2015-07-31T09:38:39Z","git_url":"git://github.com/TEAMMATES/repo.git","ssh_url":"git@github.com:TEAMMATES/repo.git","clone_url":"https://github.com/TEAMMATES/repo.git","svn_url":"https://github.com/TEAMMATES/repo","homepage":"http://teammatesv4.appspot.com/","size":157133,"stargazers_count":44,"watchers_count":44,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":124,"mirror_url":null,"open_issues_count":481,"forks":124,"open_issues":481,"watchers":44,"default_branch":"master"}},"base":{"label":"TEAMMATES:master","ref":"master","sha":"0c5b13fbb59a1e6f433afe2ee79b030a38817dd2","user":{"login":"TEAMMATES","id":7374810,"avatar_url":"https://avatars.githubusercontent.com/u/7374810?v=3","gravatar_id":"","url":"https://api.github.com/users/TEAMMATES","html_url":"https://github.com/TEAMMATES","followers_url":"https://api.github.com/users/TEAMMATES/followers","following_url":"https://api.github.com/users/TEAMMATES/following{/other_user}","gists_url":"https://api.github.com/users/TEAMMATES/gists{/gist_id}","starred_url":"https://api.github.com/users/TEAMMATES/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TEAMMATES/subscriptions","organizations_url":"https://api.github.com/users/TEAMMATES/orgs","repos_url":"https://api.github.com/users/TEAMMATES/repos","events_url":"https://api.github.com/users/TEAMMATES/events{/privacy}","received_events_url":"https://api.github.com/users/TEAMMATES/received_events","type":"Organization","site_admin":false},"repo":{"id":19369035,"name":"repo","full_name":"TEAMMATES/repo","owner":{"login":"TEAMMATES","id":7374810,"avatar_url":"https://avatars.githubusercontent.com/u/7374810?v=3","gravatar_id":"","url":"https://api.github.com/users/TEAMMATES","html_url":"https://github.com/TEAMMATES","followers_url":"https://api.github.com/users/TEAMMATES/followers","following_url":"https://api.github.com/users/TEAMMATES/following{/other_user}","gists_url":"https://api.github.com/users/TEAMMATES/gists{/gist_id}","starred_url":"https://api.github.com/users/TEAMMATES/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TEAMMATES/subscriptions","organizations_url":"https://api.github.com/users/TEAMMATES/orgs","repos_url":"https://api.github.com/users/TEAMMATES/repos","events_url":"https://api.github.com/users/TEAMMATES/events{/privacy}","received_events_url":"https://api.github.com/users/TEAMMATES/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TEAMMATES/repo","description":"This is the project website for the TEAMMATES feedback management tool for education","fork":false,"url":"https://api.github.com/repos/TEAMMATES/repo","forks_url":"https://api.github.com/repos/TEAMMATES/repo/forks","keys_url":"https://api.github.com/repos/TEAMMATES/repo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TEAMMATES/repo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TEAMMATES/repo/teams","hooks_url":"https://api.github.com/repos/TEAMMATES/repo/hooks","issue_events_url":"https://api.github.com/repos/TEAMMATES/repo/issues/events{/number}","events_url":"https://api.github.com/repos/TEAMMATES/repo/events","assignees_url":"https://api.github.com/repos/TEAMMATES/repo/assignees{/user}","branches_url":"https://api.github.com/repos/TEAMMATES/repo/branches{/branch}","tags_url":"https://api.github.com/repos/TEAMMATES/repo/tags","blobs_url":"https://api.github.com/repos/TEAMMATES/repo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TEAMMATES/repo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TEAMMATES/repo/git/refs{/sha}","trees_url":"https://api.github.com/repos/TEAMMATES/repo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TEAMMATES/repo/statuses/{sha}","languages_url":"https://api.github.com/repos/TEAMMATES/repo/languages","stargazers_url":"https://api.github.com/repos/TEAMMATES/repo/stargazers","contributors_url":"https://api.github.com/repos/TEAMMATES/repo/contributors","subscribers_url":"https://api.github.com/repos/TEAMMATES/repo/subscribers","subscription_url":"https://api.github.com/repos/TEAMMATES/repo/subscription","commits_url":"https://api.github.com/repos/TEAMMATES/repo/commits{/sha}","git_commits_url":"https://api.github.com/repos/TEAMMATES/repo/git/commits{/sha}","comments_url":"https://api.github.com/repos/TEAMMATES/repo/comments{/number}","issue_comment_url":"https://api.github.com/repos/TEAMMATES/repo/issues/comments{/number}","contents_url":"https://api.github.com/repos/TEAMMATES/repo/contents/{+path}","compare_url":"https://api.github.com/repos/TEAMMATES/repo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TEAMMATES/repo/merges","archive_url":"https://api.github.com/repos/TEAMMATES/repo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TEAMMATES/repo/downloads","issues_url":"https://api.github.com/repos/TEAMMATES/repo/issues{/number}","pulls_url":"https://api.github.com/repos/TEAMMATES/repo/pulls{/number}","milestones_url":"https://api.github.com/repos/TEAMMATES/repo/milestones{/number}","notifications_url":"https://api.github.com/repos/TEAMMATES/repo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TEAMMATES/repo/labels{/name}","releases_url":"https://api.github.com/repos/TEAMMATES/repo/releases{/id}","created_at":"2014-05-02T07:43:00Z","updated_at":"2015-07-16T06:13:09Z","pushed_at":"2015-07-31T09:38:39Z","git_url":"git://github.com/TEAMMATES/repo.git","ssh_url":"git@github.com:TEAMMATES/repo.git","clone_url":"https://github.com/TEAMMATES/repo.git","svn_url":"https://github.com/TEAMMATES/repo","homepage":"http://teammatesv4.appspot.com/","size":157133,"stargazers_count":44,"watchers_count":44,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":124,"mirror_url":null,"open_issues_count":481,"forks":124,"open_issues":481,"watchers":44,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TEAMMATES/repo/pulls/3945"},"html":{"href":"https://github.com/TEAMMATES/repo/pull/3945"},"issue":{"href":"https://api.github.com/repos/TEAMMATES/repo/issues/3945"},"comments":{"href":"https://api.github.com/repos/TEAMMATES/repo/issues/3945/comments"},"review_comments":{"href":"https://api.github.com/repos/TEAMMATES/repo/pulls/3945/comments"},"review_comment":{"href":"https://api.github.com/repos/TEAMMATES/repo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TEAMMATES/repo/pulls/3945/commits"},"statuses":{"href":"https://api.github.com/repos/TEAMMATES/repo/statuses/cfd5a993f111af5c2c64c8e632b563c3bacba495"}}}}