Search in sources :

Example 1 with FeedbackSubmissionEditResponse

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

the class FeedbackSubmissionEditPageData method createQuestionsWithResponses.

private void createQuestionsWithResponses() {
    questionsWithResponses = new ArrayList<>();
    int qnIndx = 1;
    for (FeedbackQuestionAttributes questionAttributes : bundle.getSortedQuestions()) {
        int numOfResponseBoxes = questionAttributes.numberOfEntitiesToGiveFeedbackTo;
        int maxResponsesPossible = bundle.recipientList.get(questionAttributes.getId()).size();
        if (numOfResponseBoxes == Const.MAX_POSSIBLE_RECIPIENTS || numOfResponseBoxes > maxResponsesPossible) {
            numOfResponseBoxes = maxResponsesPossible;
        }
        FeedbackSubmissionEditQuestion question = createQuestion(questionAttributes, qnIndx);
        List<FeedbackSubmissionEditResponse> responses = createResponses(questionAttributes, qnIndx, numOfResponseBoxes);
        questionsWithResponses.add(new StudentFeedbackSubmissionEditQuestionsWithResponses(question, responses, numOfResponseBoxes, maxResponsesPossible));
        qnIndx++;
    }
}
Also used : FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) FeedbackSubmissionEditQuestion(teammates.ui.template.FeedbackSubmissionEditQuestion) FeedbackSubmissionEditResponse(teammates.ui.template.FeedbackSubmissionEditResponse) StudentFeedbackSubmissionEditQuestionsWithResponses(teammates.ui.template.StudentFeedbackSubmissionEditQuestionsWithResponses)

Example 2 with FeedbackSubmissionEditResponse

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

the class FeedbackSubmissionEditPageData method createResponses.

private List<FeedbackSubmissionEditResponse> createResponses(FeedbackQuestionAttributes questionAttributes, int qnIndx, int numOfResponseBoxes) {
    List<FeedbackSubmissionEditResponse> responses = new ArrayList<>();
    List<FeedbackResponseAttributes> existingResponses = bundle.questionResponseBundle.get(questionAttributes);
    int responseIndx = 0;
    for (FeedbackResponseAttributes existingResponse : existingResponses) {
        if (!isResponseRecipientValid(existingResponse)) {
            // A response recipient can be invalid due to submission adjustment failure
            continue;
        }
        List<String> recipientOptionsForQuestion = getRecipientOptionsForQuestion(questionAttributes.getId(), existingResponse.recipient);
        String submissionFormHtml = questionAttributes.getQuestionDetails().getQuestionWithExistingResponseSubmissionFormHtml(isSessionOpenForSubmission, qnIndx, responseIndx, questionAttributes.courseId, numOfResponseBoxes, existingResponse.getResponseDetails(), student);
        responses.add(new FeedbackSubmissionEditResponse(responseIndx, true, recipientOptionsForQuestion, submissionFormHtml, existingResponse.getId()));
        responseIndx++;
    }
    while (responseIndx < numOfResponseBoxes) {
        List<String> recipientOptionsForQuestion = getRecipientOptionsForQuestion(questionAttributes.getId(), null);
        String submissionFormHtml = questionAttributes.getQuestionDetails().getQuestionWithoutExistingResponseSubmissionFormHtml(isSessionOpenForSubmission, qnIndx, responseIndx, questionAttributes.courseId, numOfResponseBoxes, student);
        responses.add(new FeedbackSubmissionEditResponse(responseIndx, false, recipientOptionsForQuestion, submissionFormHtml, ""));
        responseIndx++;
    }
    return responses;
}
Also used : FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) ArrayList(java.util.ArrayList) FeedbackSubmissionEditResponse(teammates.ui.template.FeedbackSubmissionEditResponse)

Aggregations

FeedbackSubmissionEditResponse (teammates.ui.template.FeedbackSubmissionEditResponse)2 ArrayList (java.util.ArrayList)1 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)1 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)1 FeedbackSubmissionEditQuestion (teammates.ui.template.FeedbackSubmissionEditQuestion)1 StudentFeedbackSubmissionEditQuestionsWithResponses (teammates.ui.template.StudentFeedbackSubmissionEditQuestionsWithResponses)1