Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Student: view session results: do not show self responses #6290 #8700

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package teammates.ui.template;

import java.util.ArrayList;
import java.util.List;

public class StudentFeedbackResultsQuestionWithResponses {
Expand All @@ -21,4 +22,30 @@ public List<FeedbackResultsResponseTable> getResponseTables() {
return responseTables;
}

public List<FeedbackResultsResponseTable> getSelfResponseTables() {

List<FeedbackResultsResponseTable> selfResponseTables = new ArrayList<>();

for (int i = 0; i < responseTables.size(); i++) {
if (responseTables.get(i).isGiverNameYou()) {
selfResponseTables.add(responseTables.get(i));
}
}

return selfResponseTables;
}

public List<FeedbackResultsResponseTable> getOthersResponseTables() {

List<FeedbackResultsResponseTable> othersResponseTables = new ArrayList<>();

for (int i = 0; i < responseTables.size(); i++) {
if (!responseTables.get(i).isGiverNameYou()) {
othersResponseTables.add(responseTables.get(i));
}
}

return othersResponseTables;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%@ tag description="studentFeedbackResults.jsp - Displays feedback session self-response title" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib tagdir="/WEB-INF/tags/student/feedbackResults" prefix="feedbackResults" %>

<h2>Your own response</h2>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<%@ tag description="othersResponseTable.tag - Others-responses given to a particular recipient" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib tagdir="/WEB-INF/tags/shared" prefix="shared"%>
<%@ attribute name="othersResponse" type="teammates.ui.template.FeedbackResultsResponse" required="true" %>

<tr class="resultSubheader">
<td>
<span class="bold"><b>From:</b></span> ${fn:escapeXml(othersResponse.giverName)}
</td>
</tr>

<tr>
<%-- Note: When an element has class text-preserve-space, do not insert HTML spaces --%>
<td class="text-preserve-space">${othersResponse.answer}</td>
</tr>

<c:if test="${not empty othersResponse.comments}">
<tr>
<td>
<ul class="list-group comment-list">
<c:forEach items="${othersResponse.comments}" var="comment">
<shared:feedbackResponseCommentRow frc="${comment}" />
</c:forEach>
</ul>
</td>
</tr>
</c:if>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<%@ tag description="questionWithOthersResponses.tag - Others-responses given to a particular recipient" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib tagdir="/WEB-INF/tags/student/feedbackResults" prefix="feedbackResults" %>
<%@ attribute name="othersResponseTable" type="teammates.ui.template.FeedbackResultsResponseTable" required="true" %>

<c:set value="panel-primary" var="panelHeaderClass"/>

<div class="panel ${panelHeaderClass}">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just do <div class="panel panel-primary"> directly since self response tables have now been separated from others response tables?

<div class="panel-heading">
<b>To:</b> ${fn:escapeXml(othersResponseTable.recipientName)}
</div>
<table class="table">
<tbody>
<c:forEach items="${othersResponseTable.responses}" var="othersResponse">
<feedbackResults:othersResponse othersResponse="${othersResponse}"/>
</c:forEach>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The <c: block should be indented one level further :P Because of this your HTML files have more changes than necessary as well.

</tbody>
</table>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<%@ tag description="studentFeedbackResults.jsp - Student feedback results question with others-responses" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib tagdir="/WEB-INF/tags/student/feedbackResults" prefix="feedbackResults" %>
<%@ attribute name="questionWithOthersResponses" type="teammates.ui.template.StudentFeedbackResultsQuestionWithResponses" required="true" %>

<div class="panel panel-default">
<div class="panel-heading">
<%-- Note: When an element has class text-preserve-space, do not insert HTML spaces --%>
<h4>Question ${questionWithOthersResponses.questionDetails.questionIndex}: <span class="text-preserve-space"><c:out value="${questionWithOthersResponses.questionDetails.questionText}"/>${questionWithOthersResponses.questionDetails.additionalInfo}</span></h4>

${questionWithOthersResponses.questionDetails.questionResultStatistics}

<c:if test="${questionWithOthersResponses.questionDetails.individualResponsesShownToStudents}">

<c:forEach items="${questionWithOthersResponses.othersResponseTables}" var="othersResponseTables">
<feedbackResults:othersResponseTable othersResponseTable="${othersResponseTables}"/>
</c:forEach>

</c:if>
</div>
</div>
<br>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<%@ tag description="studentFeedbackResults.jsp - Student feedback results question with self-responses" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib tagdir="/WEB-INF/tags/student/feedbackResults" prefix="feedbackResults" %>
<%@ attribute name="questionWithSelfResponses" type="teammates.ui.template.StudentFeedbackResultsQuestionWithResponses" required="true" %>

<div class="panel panel-default">
<div class="panel-heading">
<%-- Note: When an element has class text-preserve-space, do not insert HTML spaces --%>
<h4>Question ${questionWithSelfResponses.questionDetails.questionIndex}: <span class="text-preserve-space"><c:out value="${questionWithSelfResponses.questionDetails.questionText}"/>${questionWithSelfResponses.questionDetails.additionalInfo}</span></h4>

${questionWithSelfResponses.questionDetails.questionResultStatistics}

<c:if test="${questionWithSelfResponses.questionDetails.individualResponsesShownToStudents}">

<c:forEach items="${questionWithSelfResponses.selfResponseTables}" var="selfResponseTables">
<feedbackResults:selfResponseTable selfResponseTable="${selfResponseTables}"/>
</c:forEach>

</c:if>
</div>
</div>
<br>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<%@ tag description="responseTable.tag - Responses given to a particular recipient" pageEncoding="UTF-8" %>
<%@ tag description="selfResponseTable.tag - Self-responses given to a particular recipient" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib tagdir="/WEB-INF/tags/shared" prefix="shared"%>
<%@ attribute name="response" type="teammates.ui.template.FeedbackResultsResponse" required="true" %>
<%@ attribute name="selfResponse" type="teammates.ui.template.FeedbackResultsResponse" required="true" %>

<tr class="resultSubheader">
<td>
<span class="bold"><b>From:</b></span> ${fn:escapeXml(response.giverName)}
<span class="bold"><b>From:</b></span> ${fn:escapeXml(selfResponse.giverName)}
</td>
</tr>

<tr>
<%-- Note: When an element has class text-preserve-space, do not insert HTML spaces --%>
<td class="text-preserve-space">${response.answer}</td>
<td class="text-preserve-space">${selfResponse.answer}</td>
</tr>

<c:if test="${not empty response.comments}">
<c:if test="${not empty selfResponse.comments}">
<tr>
<td>
<ul class="list-group comment-list">
<c:forEach items="${response.comments}" var="comment">
<c:forEach items="${selfResponse.comments}" var="comment">
<shared:feedbackResponseCommentRow frc="${comment}" />
</c:forEach>
</ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<%@ tag description="questionWithSelfResponses.tag - Self-responses given to a particular recipient" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib tagdir="/WEB-INF/tags/student/feedbackResults" prefix="feedbackResults" %>
<%@ attribute name="selfResponseTable" type="teammates.ui.template.FeedbackResultsResponseTable" required="true" %>

<c:set value="panel-default" var="panelHeaderClass"/>

<div class="panel ${panelHeaderClass}">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here as well - why not just use panel-default directly?

<div class="panel-heading">
<b>To:</b> ${fn:escapeXml(selfResponseTable.recipientName)}
</div>
<table class="table">
<tbody>
<c:forEach items="${selfResponseTable.responses}" var="selfResponse">
<feedbackResults:selfResponse selfResponse="${selfResponse}"/>
</c:forEach>
</tbody>
</table>
</div>
12 changes: 10 additions & 2 deletions src/main/webapp/jsp/studentFeedbackResults.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@
<t:statusMessage statusMessagesToUser="${data.statusMessagesToUser}" />
<br>

<c:forEach items="${data.feedbackResultsQuestionsWithResponses}" var="questionWithResponses">
<feedbackResults:questionWithResponses questionWithResponses="${questionWithResponses}"/>
<c:forEach items="${data.feedbackResultsQuestionsWithResponses}" var="questionWithOthersResponses">
<feedbackResults:questionWithOthersResponses questionWithOthersResponses="${questionWithOthersResponses}"/>
</c:forEach>
<br>

<feedbackResults:feedbackSessionSelfResponse />
<br>

<c:forEach items="${data.feedbackResultsQuestionsWithResponses}" var="questionWithSelfResponses">
<feedbackResults:questionWithSelfResponses questionWithSelfResponses="${questionWithSelfResponses}"/>
</c:forEach>

<c:if test="${empty data.feedbackResultsQuestionsWithResponses}">
Expand Down
Loading