use of teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes in project teammates by TEAMMATES.
the class FeedbackResponseCommentsLogic method updateFeedbackResponseCommentsForResponse.
// right now this method only updates comment's giverSection and receiverSection for a given response
public void updateFeedbackResponseCommentsForResponse(String feedbackResponseId) throws InvalidParametersException, EntityDoesNotExistException {
List<FeedbackResponseCommentAttributes> comments = getFeedbackResponseCommentForResponse(feedbackResponseId);
FeedbackResponseAttributes response = frLogic.getFeedbackResponse(feedbackResponseId);
for (FeedbackResponseCommentAttributes comment : comments) {
comment.giverSection = response.giverSection;
comment.receiverSection = response.recipientSection;
frcDb.updateFeedbackResponseComment(comment);
}
}
use of teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes in project teammates by TEAMMATES.
the class FeedbackSessionsLogic method getResponseComments.
private Map<String, List<FeedbackResponseCommentAttributes>> getResponseComments(String feedbackSessionName, String courseId, String userEmail, UserRole role, CourseRoster roster, Map<String, FeedbackQuestionAttributes> relevantQuestions, String section, StudentAttributes student, Set<String> studentsEmailInTeam, Map<String, FeedbackResponseAttributes> relevantResponse) {
Map<String, List<FeedbackResponseCommentAttributes>> responseComments = new HashMap<>();
List<FeedbackResponseCommentAttributes> allResponseComments = frcLogic.getFeedbackResponseCommentForSessionInSection(courseId, feedbackSessionName, section);
for (FeedbackResponseCommentAttributes frc : allResponseComments) {
FeedbackResponseAttributes relatedResponse = relevantResponse.get(frc.feedbackResponseId);
FeedbackQuestionAttributes relatedQuestion = relevantQuestions.get(frc.feedbackQuestionId);
boolean isVisibleResponseComment = frcLogic.isResponseCommentVisibleForUser(userEmail, role, student, studentsEmailInTeam, relatedResponse, relatedQuestion, frc);
if (isVisibleResponseComment) {
if (!frcLogic.isNameVisibleToUser(frc, relatedResponse, userEmail, roster)) {
frc.giverEmail = Const.DISPLAYED_NAME_FOR_ANONYMOUS_PARTICIPANT;
}
List<FeedbackResponseCommentAttributes> frcList = responseComments.get(frc.feedbackResponseId);
if (frcList == null) {
frcList = new ArrayList<>();
frcList.add(frc);
responseComments.put(frc.feedbackResponseId, frcList);
} else {
frcList.add(frc);
}
}
}
for (List<FeedbackResponseCommentAttributes> responseCommentList : responseComments.values()) {
sortByCreatedDate(responseCommentList);
}
return responseComments;
}
use of teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes in project teammates by TEAMMATES.
the class FeedbackResponseCommentsLogicTest method restoreFrCommentIdFromExistingOne.
private void restoreFrCommentIdFromExistingOne(FeedbackResponseCommentAttributes frComment, FeedbackResponseCommentAttributes existingFrComment) {
List<FeedbackResponseCommentAttributes> existingFrComments = frcLogic.getFeedbackResponseCommentForSession(existingFrComment.courseId, existingFrComment.feedbackSessionName);
FeedbackResponseCommentAttributes existingFrCommentWithId = null;
for (FeedbackResponseCommentAttributes c : existingFrComments) {
if (c.commentText.equals(existingFrComment.commentText)) {
existingFrCommentWithId = c;
break;
}
}
if (existingFrCommentWithId != null) {
frComment.setId(existingFrCommentWithId.getId());
frComment.feedbackResponseId = existingFrCommentWithId.feedbackResponseId;
}
}
use of teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes in project teammates by TEAMMATES.
the class FeedbackResponseCommentsLogicTest method verifyNullFromGetFrComment.
private void verifyNullFromGetFrComment(FeedbackResponseCommentAttributes frComment) {
FeedbackResponseCommentAttributes frCommentGot = frcLogic.getFeedbackResponseComment(frComment.feedbackResponseId, frComment.giverEmail, frComment.createdAt);
assertNull(frCommentGot);
}
use of teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes in project teammates by TEAMMATES.
the class FeedbackResponsesLogicTest method getFeedbackResponseCommentsForResponsesFromDatastore.
private List<FeedbackResponseCommentAttributes> getFeedbackResponseCommentsForResponsesFromDatastore(List<FeedbackResponseAttributes> responses) {
List<FeedbackResponseCommentAttributes> responseComments = new ArrayList<>();
for (FeedbackResponseAttributes response : responses) {
List<FeedbackResponseCommentAttributes> responseCommentsForResponse = frcLogic.getFeedbackResponseCommentForResponse(response.getId());
responseComments.addAll(responseCommentsForResponse);
}
return responseComments;
}
Aggregations