Search in sources :

Example 21 with FeedbackResponseCommentAttributes

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);
    }
}
Also used : FeedbackResponseCommentAttributes(teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes)

Example 22 with FeedbackResponseCommentAttributes

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;
}
Also used : FeedbackResponseCommentAttributes(teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) HashMap(java.util.HashMap) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) ArrayList(java.util.ArrayList) List(java.util.List)

Example 23 with FeedbackResponseCommentAttributes

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;
    }
}
Also used : FeedbackResponseCommentAttributes(teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes)

Example 24 with FeedbackResponseCommentAttributes

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);
}
Also used : FeedbackResponseCommentAttributes(teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes)

Example 25 with FeedbackResponseCommentAttributes

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;
}
Also used : FeedbackResponseCommentAttributes(teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) ArrayList(java.util.ArrayList)

Aggregations

FeedbackResponseCommentAttributes (teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes)46 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)15 Test (org.testng.annotations.Test)13 Text (com.google.appengine.api.datastore.Text)12 ArrayList (java.util.ArrayList)12 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)9 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)9 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)9 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)6 FeedbackResponseCommentsDb (teammates.storage.api.FeedbackResponseCommentsDb)6 FeedbackQuestionsDb (teammates.storage.api.FeedbackQuestionsDb)5 FeedbackResponsesDb (teammates.storage.api.FeedbackResponsesDb)5 InstructorFeedbackResponseCommentAjaxPageData (teammates.ui.pagedata.InstructorFeedbackResponseCommentAjaxPageData)4 FeedbackResponseCommentRow (teammates.ui.template.FeedbackResponseCommentRow)4 InvalidParametersException (teammates.common.exception.InvalidParametersException)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2 FeedbackResponseCommentSearchResultBundle (teammates.common.datatransfer.FeedbackResponseCommentSearchResultBundle)2 FeedbackSessionResultsBundle (teammates.common.datatransfer.FeedbackSessionResultsBundle)2