Search in sources :

Example 6 with FeedbackResponseCommentRow

use of teammates.ui.template.FeedbackResponseCommentRow in project teammates by TEAMMATES.

the class StudentFeedbackResultsPageData method createResponseTable.

/**
 * Creates a feedback results responses table for a recipient.
 * @param question  Question for which the responses are generated
 * @param responsesBundleForRecipient  All responses for the question having a particular recipient
 * @return Feedback results responses table for a question and a recipient
 */
private FeedbackResultsResponseTable createResponseTable(FeedbackQuestionAttributes question, List<FeedbackResponseAttributes> responsesBundleForRecipient, String recipientNameParam) {
    List<FeedbackResultsResponse> responses = new ArrayList<>();
    FeedbackQuestionDetails questionDetails = question.getQuestionDetails();
    String recipientName = removeAnonymousHash(recipientNameParam);
    for (FeedbackResponseAttributes response : responsesBundleForRecipient) {
        String giverName = bundle.getGiverNameForResponse(response);
        String displayedGiverName;
        /* Change display name to 'You' or 'Your team' or 'Anonymous student' if necessary */
        boolean isUserGiver = student.email.equals(response.giver);
        boolean isUserPartOfGiverTeam = student.team.equals(giverName);
        if (question.giverType == FeedbackParticipantType.TEAMS && isUserPartOfGiverTeam) {
            displayedGiverName = "Your Team (" + giverName + ")";
        } else if (isUserGiver) {
            displayedGiverName = "You";
        } else {
            displayedGiverName = removeAnonymousHash(giverName);
        }
        boolean isUserRecipient = student.email.equals(response.recipient);
        if (isUserGiver && !isUserRecipient) {
            // If the giver is the user, show the real name of the recipient
            // since the giver would know which recipient he/she gave the response to
            recipientName = bundle.getNameForEmail(response.recipient);
        }
        String answer = response.getResponseDetails().getAnswerHtmlStudentView(questionDetails);
        List<FeedbackResponseCommentRow> comments = createStudentFeedbackResultsResponseComments(response.getId());
        responses.add(new FeedbackResultsResponse(displayedGiverName, answer, comments));
    }
    return new FeedbackResultsResponseTable(recipientName, responses);
}
Also used : FeedbackResultsResponse(teammates.ui.template.FeedbackResultsResponse) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) FeedbackQuestionDetails(teammates.common.datatransfer.questions.FeedbackQuestionDetails) ArrayList(java.util.ArrayList) FeedbackResponseCommentRow(teammates.ui.template.FeedbackResponseCommentRow) FeedbackResultsResponseTable(teammates.ui.template.FeedbackResultsResponseTable)

Example 7 with FeedbackResponseCommentRow

use of teammates.ui.template.FeedbackResponseCommentRow in project teammates by TEAMMATES.

the class InstructorFeedbackResponseCommentAjaxPageData method getComment.

public FeedbackResponseCommentRow getComment() {
    FeedbackResponseCommentRow frc = new FeedbackResponseCommentRow(comment, comment.giverEmail, giverName, recipientName, showCommentToString, showGiverNameToString, getResponseVisibilities(), instructorEmailNameTable, sessionTimeZone);
    frc.enableEditDelete();
    return frc;
}
Also used : FeedbackResponseCommentRow(teammates.ui.template.FeedbackResponseCommentRow)

Example 8 with FeedbackResponseCommentRow

use of teammates.ui.template.FeedbackResponseCommentRow in project teammates by TEAMMATES.

the class InstructorSearchPageData method createFeedbackResponseCommentRows.

private List<FeedbackResponseCommentRow> createFeedbackResponseCommentRows(FeedbackResponseAttributes responseEntry, FeedbackResponseCommentSearchResultBundle frcSearchResultBundle) {
    List<FeedbackResponseCommentRow> rows = new ArrayList<>();
    List<FeedbackResponseCommentAttributes> frcList = frcSearchResultBundle.comments.get(responseEntry.getId());
    for (FeedbackResponseCommentAttributes frc : frcList) {
        String frCommentGiver = frcSearchResultBundle.commentGiverTable.get(frc.getId().toString());
        if (!Const.DISPLAYED_NAME_FOR_ANONYMOUS_PARTICIPANT.equals(frCommentGiver)) {
            frCommentGiver = frc.giverEmail;
        }
        ZoneId sessionTimeZone = frcSearchResultBundle.sessions.get(responseEntry.feedbackSessionName).getTimeZone();
        FeedbackResponseCommentRow frcDiv = new FeedbackResponseCommentRow(frc, frCommentGiver, frcSearchResultBundle.instructorEmailNameTable, sessionTimeZone);
        rows.add(frcDiv);
    }
    return rows;
}
Also used : FeedbackResponseCommentAttributes(teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes) ZoneId(java.time.ZoneId) ArrayList(java.util.ArrayList) FeedbackResponseCommentRow(teammates.ui.template.FeedbackResponseCommentRow)

Example 9 with FeedbackResponseCommentRow

use of teammates.ui.template.FeedbackResponseCommentRow in project teammates by TEAMMATES.

the class StudentFeedbackResultsPageData method createStudentFeedbackResultsResponseComments.

/**
 * Creates a list of comments for a feedback results response.
 * @param feedbackResponseId  Response ID for which comments are created
 * @return Comments for the response
 */
private List<FeedbackResponseCommentRow> createStudentFeedbackResultsResponseComments(String feedbackResponseId) {
    List<FeedbackResponseCommentRow> comments = new ArrayList<>();
    List<FeedbackResponseCommentAttributes> commentsBundle = bundle.responseComments.get(feedbackResponseId);
    if (commentsBundle != null) {
        for (FeedbackResponseCommentAttributes comment : commentsBundle) {
            comments.add(new FeedbackResponseCommentRow(comment, comment.giverEmail, bundle.instructorEmailNameTable, bundle.getTimeZone()));
        }
    }
    return comments;
}
Also used : FeedbackResponseCommentAttributes(teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes) ArrayList(java.util.ArrayList) FeedbackResponseCommentRow(teammates.ui.template.FeedbackResponseCommentRow)

Aggregations

FeedbackResponseCommentRow (teammates.ui.template.FeedbackResponseCommentRow)9 ArrayList (java.util.ArrayList)6 FeedbackParticipantType (teammates.common.datatransfer.FeedbackParticipantType)4 FeedbackResponseCommentAttributes (teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes)4 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)3 Text (com.google.appengine.api.datastore.Text)1 ZoneId (java.time.ZoneId)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Matcher (java.util.regex.Matcher)1 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)1 FeedbackQuestionDetails (teammates.common.datatransfer.questions.FeedbackQuestionDetails)1 FeedbackResultsResponse (teammates.ui.template.FeedbackResultsResponse)1 FeedbackResultsResponseTable (teammates.ui.template.FeedbackResultsResponseTable)1 InstructorFeedbackResultsModerationButton (teammates.ui.template.InstructorFeedbackResultsModerationButton)1 InstructorFeedbackResultsResponsePanel (teammates.ui.template.InstructorFeedbackResultsResponsePanel)1 InstructorFeedbackResultsResponseRow (teammates.ui.template.InstructorFeedbackResultsResponseRow)1