use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes 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++;
}
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class StudentFeedbackResultsPageAction method execute.
@Override
protected ActionResult execute() throws EntityDoesNotExistException {
String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
if (courseId == null || feedbackSessionName == null) {
return createRedirectResult(Const.ActionURIs.STUDENT_HOME_PAGE);
}
if (!isJoinedCourse(courseId)) {
return createPleaseJoinCourseResponse(courseId);
}
gateKeeper.verifyAccessible(getCurrentStudent(courseId), logic.getFeedbackSession(feedbackSessionName, courseId));
StudentFeedbackResultsPageData data = new StudentFeedbackResultsPageData(account, student, sessionToken);
data.student = getCurrentStudent(courseId);
data.setBundle(logic.getFeedbackSessionResultsForStudent(feedbackSessionName, courseId, data.student.email));
if (data.getBundle() == null) {
// leave this here as a safety net on the off cases that GateKeeper fails to catch the Exception
throw new EntityDoesNotExistException("Feedback session " + feedbackSessionName + " does not exist in " + courseId + ".");
}
if (!data.getBundle().feedbackSession.isPublished()) {
throw new UnauthorizedAccessException("This feedback session is not yet visible.");
}
if (data.getBundle().isStudentHasSomethingNewToSee(data.student)) {
statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_RESULTS_SOMETHINGNEW, StatusMessageColor.INFO));
} else {
statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_RESULTS_NOTHINGNEW, StatusMessageColor.WARNING));
}
statusToAdmin = "Show student feedback result page<br>" + "Session Name: " + feedbackSessionName + "<br>" + "Course ID: " + courseId;
Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> questionsWithResponses = data.getBundle().getQuestionResponseMapSortedByRecipient();
data.init(questionsWithResponses);
return createShowPageResult(Const.ViewURIs.STUDENT_FEEDBACK_RESULTS, data);
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class FeedbackQuestionsLogic method shiftQuestionNumbersDown.
// Shifts all question numbers after questionNumberToShiftFrom down by one.
private void shiftQuestionNumbersDown(int questionNumberToShiftFrom, List<FeedbackQuestionAttributes> questionsToShift) {
for (FeedbackQuestionAttributes question : questionsToShift) {
if (question.questionNumber > questionNumberToShiftFrom) {
question.questionNumber -= 1;
updateFeedbackQuestionWithoutResponseRateUpdate(question);
}
}
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class FeedbackResponsesLogic method updateFeedbackResponseForChangingTeam.
public boolean updateFeedbackResponseForChangingTeam(StudentEnrollDetails enrollment, FeedbackResponseAttributes response) throws InvalidParametersException, EntityDoesNotExistException {
FeedbackQuestionAttributes question = fqLogic.getFeedbackQuestion(response.feedbackQuestionId);
boolean isGiverSameForResponseAndEnrollment = response.giver.equals(enrollment.email);
boolean isReceiverSameForResponseAndEnrollment = response.recipient.equals(enrollment.email);
boolean shouldDeleteByChangeOfGiver = isGiverSameForResponseAndEnrollment && (question.giverType == FeedbackParticipantType.TEAMS || isRecipientTypeTeamMembers(question));
boolean shouldDeleteByChangeOfRecipient = isReceiverSameForResponseAndEnrollment && isRecipientTypeTeamMembers(question);
boolean shouldDeleteResponse = shouldDeleteByChangeOfGiver || shouldDeleteByChangeOfRecipient;
if (shouldDeleteResponse) {
frDb.deleteEntity(response);
updateSessionResponseRateForDeletingStudentResponse(enrollment.email, response.feedbackSessionName, enrollment.course);
}
return shouldDeleteResponse;
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class FeedbackResponsesLogic method deleteResponsesFromUserToTeam.
private void deleteResponsesFromUserToTeam(String courseId, String userEmail) {
FeedbackQuestionAttributes question;
List<FeedbackResponseAttributes> responsesFromUser = getFeedbackResponsesFromGiverForCourse(courseId, userEmail);
for (FeedbackResponseAttributes response : responsesFromUser) {
question = fqLogic.getFeedbackQuestion(response.feedbackQuestionId);
if (question.giverType == FeedbackParticipantType.TEAMS || isRecipientTypeTeamMembers(question)) {
frDb.deleteEntity(response);
}
}
}
Aggregations