Skip to content

Commit

Permalink
[#8630] Instructor: remind particular students: show sorted student l…
Browse files Browse the repository at this point in the history
…ist (#8653)
  • Loading branch information
moazbaghdadi authored and whipermr5 committed Mar 24, 2018
1 parent bb32eb9 commit cd9a536
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.Map;

public class FeedbackSessionResponseStatus {
public List<String> noResponse;
public List<String> studentsWhoDidNotRespond;
public List<String> studentsWhoResponded;
public Map<String, String> emailNameTable;
public Map<String, String> emailSectionTable;
Expand Down Expand Up @@ -50,7 +50,7 @@ public class FeedbackSessionResponseStatus {
private Comparator<String> compareByTeamNameStudentName = compareByTeamName.thenComparing(compareByName);

public FeedbackSessionResponseStatus() {
noResponse = new ArrayList<>();
studentsWhoDidNotRespond = new ArrayList<>();
studentsWhoResponded = new ArrayList<>();
emailNameTable = new HashMap<>();
emailSectionTable = new HashMap<>();
Expand All @@ -61,16 +61,25 @@ public FeedbackSessionResponseStatus() {
* Returns list of students who did not respond to the feedback session
* sorted by teamName > studentNamelist.
*/
public List<String> getStudentsWhoDidNotRespondToAnyQuestion() {
noResponse.sort(compareByTeamNameStudentName);
return noResponse;
public List<String> getStudentsWhoDidNotRespondSorted() {
studentsWhoDidNotRespond.sort(compareByTeamNameStudentName);
return studentsWhoDidNotRespond;
}

/**
* Returns list of students who did not respond to the feedback session.
*/
public List<String> getNoResponse() {
return noResponse;
public List<String> getStudentsWhoDidNotRespond() {
return studentsWhoDidNotRespond;
}

/**
* Returns list of students who responded to the feedback session
* sorted by teamName > studentNamelist.
*/
public List<String> getStudentsWhoRespondedSorted() {
studentsWhoResponded.sort(compareByTeamNameStudentName);
return studentsWhoResponded;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/teammates/logic/core/FeedbackSessionsLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -2171,9 +2171,9 @@ private FeedbackSessionResponseStatus getFeedbackSessionResponseStatus(
}
instructorNoResponses.removeAll(fsa.getRespondingInstructorList());

responseStatus.noResponse.addAll(studentNoResponses);
responseStatus.studentsWhoDidNotRespond.addAll(studentNoResponses);
responseStatus.studentsWhoResponded.addAll(studentResponded);
responseStatus.noResponse.addAll(instructorNoResponses);
responseStatus.studentsWhoDidNotRespond.addAll(instructorNoResponses);

return responseStatus;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public InstructorFeedbackResultsNoResponsePanel(FeedbackSessionResponseStatus re
String remindParticularStudentsLink) {
this.instructorStatus = new HashMap<>();
this.names = Collections.unmodifiableMap(responseStatus.emailNameTable);
this.emails = getFilteredEmails(responseStatus.getStudentsWhoDidNotRespondToAnyQuestion());
this.emails = getFilteredEmails(responseStatus.getStudentsWhoDidNotRespondSorted());
this.teams = getTeamsWithInstructorTeam(responseStatus.emailTeamNameTable,
Const.USER_TEAM_FOR_INSTRUCTOR);
this.moderationButtons = moderationButtons;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<span class="icon-sort unsorted"></span>
</th>
</tr>
<c:forEach items="${data.responseStatus.noResponse}" var="userToRemindEmail">
<c:forEach items="${data.responseStatus.studentsWhoDidNotRespondSorted}" var="userToRemindEmail">
<tr class="bg-danger">
<td class="align-center">
<div class="checkbox">
Expand All @@ -52,7 +52,7 @@
</td>
</tr>
</c:forEach>
<c:forEach items="${data.responseStatus.studentsWhoResponded}" var="userToRemindEmail">
<c:forEach items="${data.responseStatus.studentsWhoRespondedSorted}" var="userToRemindEmail">
<tr class="bg-info">
<td class="align-center">
<div class="checkbox">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ public void testExecuteAndPostProcess() {

InstructorFeedbackRemindParticularStudentsPageData pageData =
(InstructorFeedbackRemindParticularStudentsPageData) r.data;
assertEquals(6, pageData.getResponseStatus().noResponse.size());
assertEquals(6, pageData.getResponseStatus().studentsWhoDidNotRespond.size());
assertEquals(3, pageData.getResponseStatus().studentsWhoResponded.size());

assertTrue(pageData.getResponseStatus().studentsWhoResponded.contains("student1InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().noResponse.contains("student2InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("student2InCourse1@gmail.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoResponded.contains("student3InCourse1@gmail.tmt"));
assertTrue(pageData.getResponseStatus().noResponse.contains("student4InCourse1@gmail.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("student4InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoResponded.contains("student5InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().noResponse.contains("student6InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("student6InCourse1@gmail.tmt"));

assertFalse(pageData.getResponseStatus().noResponse.contains("instructor1@course1.tmt"));
assertTrue(pageData.getResponseStatus().noResponse.contains("instructor2@course1.tmt"));
assertTrue(pageData.getResponseStatus().noResponse.contains("instructor3@course1.tmt"));
assertFalse(pageData.getResponseStatus().noResponse.contains("instructor4@course1.tmt"));
assertTrue(pageData.getResponseStatus().noResponse.contains("helper@course1.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("instructor1@course1.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("instructor2@course1.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("instructor3@course1.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("instructor4@course1.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("helper@course1.tmt"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private void verifyRespondentInSessionRespondentsList(FeedbackSessionAttributes
boolean isInstructor) throws EntityDoesNotExistException {
FeedbackSessionResponseStatus responseStatus =
fsLogic.getFeedbackSessionResponseStatus(session.getFeedbackSessionName(), session.getCourseId());
assertFalse(responseStatus.getNoResponse().contains(respondentEmail));
assertFalse(responseStatus.getStudentsWhoDidNotRespond().contains(respondentEmail));
if (!isInstructor) {
assertTrue(responseStatus.getStudentsWhoResponded().contains(respondentEmail));
}
Expand All @@ -121,7 +121,7 @@ private void verifyRespondentNotInSessionRespondentsList(FeedbackSessionAttribut
boolean isInstructor) throws EntityDoesNotExistException {
FeedbackSessionResponseStatus responseStatus =
fsLogic.getFeedbackSessionResponseStatus(session.getFeedbackSessionName(), session.getCourseId());
assertTrue(responseStatus.getNoResponse().contains(respondentEmail));
assertTrue(responseStatus.getStudentsWhoDidNotRespond().contains(respondentEmail));
if (!isInstructor) {
assertFalse(responseStatus.getStudentsWhoResponded().contains(respondentEmail));
}
Expand Down

0 comments on commit cd9a536

Please sign in to comment.