diff --git a/src/e2e/java/teammates/e2e/cases/StudentFeedbackResultsPageE2ETest.java b/src/e2e/java/teammates/e2e/cases/StudentFeedbackResultsPageE2ETest.java index e1a1dedecbf..a762d15ce96 100644 --- a/src/e2e/java/teammates/e2e/cases/StudentFeedbackResultsPageE2ETest.java +++ b/src/e2e/java/teammates/e2e/cases/StudentFeedbackResultsPageE2ETest.java @@ -140,8 +140,7 @@ private List getGivenResponses(StudentAttributes cur FeedbackQuestionAttributes question) { List givenResponses = testData.feedbackResponses.values().stream() .filter(f -> f.getFeedbackQuestionId().equals(Integer.toString(question.getQuestionNumber())) - && f.getGiver().equals(currentStudent.getEmail()) - && !f.getRecipient().equals(currentStudent.getEmail())) + && f.getGiver().equals(currentStudent.getEmail())) .collect(Collectors.toList()); return editIdentifiers(currentStudent, givenResponses); } diff --git a/src/e2e/java/teammates/e2e/pageobjects/StudentFeedbackResultsPage.java b/src/e2e/java/teammates/e2e/pageobjects/StudentFeedbackResultsPage.java index ebd04b886bf..37f08ed70d6 100644 --- a/src/e2e/java/teammates/e2e/pageobjects/StudentFeedbackResultsPage.java +++ b/src/e2e/java/teammates/e2e/pageobjects/StudentFeedbackResultsPage.java @@ -151,7 +151,11 @@ private void verifyOtherResponses(FeedbackQuestionAttributes question, List recipients = getRecipients(otherResponses); for (String recipient : recipients) { List expectedResponses = otherResponses.stream() - .filter(r -> r.getRecipient().equals(recipient)) + .filter(r -> r.getRecipient().equals(recipient) + && (question.isResponseVisibleTo(FeedbackParticipantType.RECEIVER) + || question.isResponseVisibleTo(FeedbackParticipantType.STUDENTS) + || question.isResponseVisibleTo(FeedbackParticipantType.OWN_TEAM_MEMBERS) + || question.isResponseVisibleTo(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS))) .collect(Collectors.toList()); verifyResponseForRecipient(question, recipient, expectedResponses, visibleGivers, visibleRecipients); diff --git a/src/main/java/teammates/ui/output/SessionResultsData.java b/src/main/java/teammates/ui/output/SessionResultsData.java index 24f39ad2c68..a88f0b0371f 100644 --- a/src/main/java/teammates/ui/output/SessionResultsData.java +++ b/src/main/java/teammates/ui/output/SessionResultsData.java @@ -89,16 +89,22 @@ public static SessionResultsData initForStudent(SessionResultsBundle bundle, Stu boolean isUserGiver = student.getEmail().equals(response.getGiver()); boolean isUserRecipient = student.getEmail().equals(response.getRecipient()); ResponseOutput responseOutput = buildSingleResponseForStudent(response, bundle, student); + if (isUserRecipient) { qnOutput.responsesToSelf.add(responseOutput); - } else if (isUserGiver) { + } + + if (isUserGiver) { qnOutput.responsesFromSelf.add(responseOutput); - } else { + } + + if (!isUserRecipient && !isUserGiver) { // we don't need care about the keys of the map here // as only the values of the map will be used otherResponsesMap.computeIfAbsent(response.getRecipient(), k -> new ArrayList<>()) .add(responseOutput); } + qnOutput.allResponses.add(responseOutput); } } diff --git a/src/web/app/pages-session/session-result-page/__snapshots__/session-result-page.component.spec.ts.snap b/src/web/app/pages-session/session-result-page/__snapshots__/session-result-page.component.spec.ts.snap index 868790555e6..0c9a54bbd99 100644 --- a/src/web/app/pages-session/session-result-page/__snapshots__/session-result-page.component.spec.ts.snap +++ b/src/web/app/pages-session/session-result-page/__snapshots__/session-result-page.component.spec.ts.snap @@ -626,33 +626,14 @@ exports[`SessionResultPageComponent should snap with feedback session with quest - - - - - - - - - - - - - - - -
- -
-
- Your own responses (to others): + Your own responses:
@@ -759,219 +740,14 @@ exports[`SessionResultPageComponent should snap with feedback session with quest - - - - -
-
-
- Comparison of Work Distribution -
-
-
-
- - - My view: - - -
-
- - of me: - -   - - - - - - - - - E -100% - - - - -
-
- - of others: - -   - -   - - - -
-
-
-
- - Team view: - -
-
- - - of me:  - - - - - - - - - - - E -100% - - - - -
-
- - of others: - -   - -
-
-
-
-
- - -
- - - - - - - - - -
- - -
-
- - - To: - - giver1 - -
-
- - - - - - - - - - - - - - -
- - From: - - giver1 -
- - - - - - - - - - - -
-
-
-
-
- -
- Your own responses (to others): + Your own responses:
@@ -1139,174 +915,14 @@ exports[`SessionResultPageComponent should snap with feedback session with quest - - - - - - - - -
-
-
- - Response Summary - - - (of received responses) - - - -
-
- -
-
-
-
- - - - - - - - - - - - - - -
- - Question - - - - - - - - - - Poor - - - - - - - - - - Average - - - - - - - - - - Good - - - - - - - -
-
-
-
- -
-
- - - - -
-
- -
-
- Your own responses (to others): + Your own responses:
diff --git a/src/web/app/pages-session/session-result-page/session-result-page.component.html b/src/web/app/pages-session/session-result-page/session-result-page.component.html index f7b2466df77..8e0fd657673 100644 --- a/src/web/app/pages-session/session-result-page/session-result-page.component.html +++ b/src/web/app/pages-session/session-result-page/session-result-page.component.html @@ -46,16 +46,18 @@

- - -
- +
+ + +
+ +
- Your own responses (to others): + Your own responses:
diff --git a/src/web/app/pages-session/session-result-page/session-result-page.component.ts b/src/web/app/pages-session/session-result-page/session-result-page.component.ts index b8f7e3427ff..1080d4eeb56 100644 --- a/src/web/app/pages-session/session-result-page/session-result-page.component.ts +++ b/src/web/app/pages-session/session-result-page/session-result-page.component.ts @@ -19,7 +19,7 @@ import { SessionResults, SessionVisibleSetting, Student, } from '../../../types/api-output'; -import { Intent } from '../../../types/api-request'; +import { FeedbackVisibilityType, Intent } from '../../../types/api-request'; import { DEFAULT_NUMBER_OF_RETRY_ATTEMPTS } from '../../../types/default-retry-attempts'; import { ErrorReportComponent } from '../../components/error-report/error-report.component'; import { ErrorMessageOutput } from '../../error-message-output'; @@ -192,6 +192,13 @@ export class SessionResultPageComponent implements OnInit { }); } + canStudentSeeResponses(question: QuestionOutput): boolean { + const showResponsesTo: FeedbackVisibilityType[] = question.feedbackQuestion.showResponsesTo; + + return showResponsesTo.filter((visibilityType: FeedbackVisibilityType) => + visibilityType !== FeedbackVisibilityType.INSTRUCTORS).length > 0; + } + /** * Redirects to join course link for unregistered student. */