use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackRemindAction method execute.
@Override
protected ActionResult execute() {
String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
String nextUrl = getRequestParamValue(Const.ParamsNames.NEXT_URL);
if (nextUrl == null) {
nextUrl = Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE;
}
FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId);
gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(courseId, account.googleId), feedbackSession, false, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION);
if (!feedbackSession.isOpened()) {
statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSESSIONNOTOPEN, StatusMessageColor.DANGER));
statusToAdmin = "Reminder email could not be sent out as the feedback session is not open for submissions.";
return createRedirectResult(nextUrl);
}
taskQueuer.scheduleFeedbackSessionReminders(courseId, feedbackSessionName, account.googleId);
statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSENT, StatusMessageColor.SUCCESS));
statusToAdmin = "Email sent out to all students who have not completed " + "Feedback Session <span class=\"bold\">(" + feedbackSessionName + ")</span> " + "of Course <span class=\"bold\">[" + courseId + "]</span>";
return createRedirectResult(nextUrl);
}
use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackRemindParticularStudentsPageAction method execute.
@Override
protected ActionResult execute() throws EntityDoesNotExistException {
String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId);
String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName);
FeedbackSessionAttributes fsa = logic.getFeedbackSession(feedbackSessionName, courseId);
InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId);
gateKeeper.verifyAccessible(instructor, fsa, false);
FeedbackSessionResponseStatus fsResponseStatus = logic.getFeedbackSessionResponseStatus(feedbackSessionName, courseId);
InstructorFeedbackRemindParticularStudentsPageData data = new InstructorFeedbackRemindParticularStudentsPageData(account, sessionToken, fsResponseStatus, courseId, feedbackSessionName);
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_AJAX_REMIND_PARTICULAR_STUDENTS_MODAL, data);
}
use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackResultsDownloadAction method execute.
@Override
protected ActionResult execute() throws EntityDoesNotExistException {
String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
String section = getRequestParamValue(Const.ParamsNames.SECTION_NAME);
boolean isMissingResponsesShown = getRequestParamAsBoolean(Const.ParamsNames.FEEDBACK_RESULTS_INDICATE_MISSING_RESPONSES);
boolean isStatsShown = getRequestParamAsBoolean(Const.ParamsNames.FEEDBACK_RESULTS_SHOWSTATS);
String questionId = getRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_ID);
String questionNumber = getRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_NUMBER);
Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId);
Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName);
InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId);
FeedbackSessionAttributes session = logic.getFeedbackSession(feedbackSessionName, courseId);
boolean isCreatorOnly = true;
gateKeeper.verifyAccessible(instructor, session, !isCreatorOnly);
String fileContent;
String fileName;
try {
String questionName = "";
if (questionNumber != null) {
questionName = "_question" + questionNumber;
}
if (section == null || "All".equals(section)) {
fileContent = logic.getFeedbackSessionResultSummaryAsCsv(courseId, feedbackSessionName, instructor.email, isMissingResponsesShown, isStatsShown, questionId);
fileName = courseId + "_" + feedbackSessionName + questionName;
statusToAdmin = "Summary data for Feedback Session " + feedbackSessionName + " in Course " + courseId + " was downloaded";
} else {
fileContent = logic.getFeedbackSessionResultSummaryInSectionAsCsv(courseId, feedbackSessionName, instructor.email, section, questionId, isMissingResponsesShown, isStatsShown);
fileName = courseId + "_" + feedbackSessionName + "_" + section + questionName;
statusToAdmin = "Summary data for Feedback Session " + feedbackSessionName + " in Course " + courseId + " within " + section + " was downloaded";
}
} catch (ExceedingRangeException e) {
// not tested as the test file is not large enough to reach this catch block
statusToUser.add(new StatusMessage("This session has more responses than that can be downloaded in one go. " + "Please download responses for " + (questionNumber == null ? "one question at a time instead. " + "To download responses for a specific question, click on the corresponding question number." : "section instead."), StatusMessageColor.DANGER));
isError = true;
RedirectResult result = createRedirectResult(Const.ActionURIs.INSTRUCTOR_FEEDBACK_RESULTS_PAGE);
result.addResponseParam(Const.ParamsNames.COURSE_ID, courseId);
result.addResponseParam(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName);
return result;
}
return createFileDownloadResult(fileName, fileContent);
}
use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageAction method execute.
@Override
protected ActionResult execute() throws EntityDoesNotExistException {
String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
String showStats = getRequestParamValue(Const.ParamsNames.FEEDBACK_RESULTS_SHOWSTATS);
Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId);
Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName);
statusToAdmin = "Show instructor feedback result page<br>" + "Session Name: " + feedbackSessionName + "<br>" + "Course ID: " + courseId;
InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId);
FeedbackSessionAttributes session = logic.getFeedbackSession(feedbackSessionName, courseId);
boolean isCreatorOnly = true;
gateKeeper.verifyAccessible(instructor, session, !isCreatorOnly);
InstructorFeedbackResultsPageData data = new InstructorFeedbackResultsPageData(account, sessionToken);
String selectedSection = getRequestParamValue(Const.ParamsNames.FEEDBACK_RESULTS_GROUPBYSECTION);
if (selectedSection == null) {
selectedSection = ALL_SECTION_OPTION;
}
boolean isMissingResponsesShown = getRequestParamAsBoolean(Const.ParamsNames.FEEDBACK_RESULTS_INDICATE_MISSING_RESPONSES);
// this is for ajax loading of the html table in the modal
// "(Non-English characters not displayed properly in the downloaded file? click here)"
// TODO move into another action and another page data class
boolean isLoadingCsvResultsAsHtml = getRequestParamAsBoolean(Const.ParamsNames.CSV_TO_HTML_TABLE_NEEDED);
if (isLoadingCsvResultsAsHtml) {
return createAjaxResultForCsvTableLoadedInHtml(courseId, feedbackSessionName, instructor, data, selectedSection, isMissingResponsesShown, Boolean.valueOf(showStats));
}
data.setSessionResultsHtmlTableAsString("");
data.setAjaxStatus("");
String groupByTeam = getRequestParamValue(Const.ParamsNames.FEEDBACK_RESULTS_GROUPBYTEAM);
String sortType = getRequestParamValue(Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE);
String startIndex = getRequestParamValue(Const.ParamsNames.FEEDBACK_RESULTS_MAIN_INDEX);
if (startIndex != null) {
data.setStartIndex(Integer.parseInt(startIndex));
}
if (sortType == null) {
// default view: sort by question, statistics shown, grouped by team.
showStats = "on";
groupByTeam = "on";
sortType = Const.FeedbackSessionResults.QUESTION_SORT_TYPE;
isMissingResponsesShown = true;
}
String questionId = getRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_ID);
String isTestingAjax = getRequestParamValue(Const.ParamsNames.FEEDBACK_RESULTS_NEED_AJAX);
if (ALL_SECTION_OPTION.equals(selectedSection) && questionId == null && !Const.FeedbackSessionResults.QUESTION_SORT_TYPE.equals(sortType)) {
// bundle for all questions and all sections
data.setBundle(logic.getFeedbackSessionResultsForInstructorWithinRangeFromView(feedbackSessionName, courseId, instructor.email, DEFAULT_SECTION_QUERY_RANGE, sortType));
} else if (Const.FeedbackSessionResults.QUESTION_SORT_TYPE.equals(sortType)) {
data.setBundle(getBundleForQuestionView(isTestingAjax, courseId, feedbackSessionName, instructor, data, selectedSection, sortType, questionId));
} else if (Const.FeedbackSessionResults.GQR_SORT_TYPE.equals(sortType) || Const.FeedbackSessionResults.GRQ_SORT_TYPE.equals(sortType)) {
data.setBundle(logic.getFeedbackSessionResultsForInstructorFromSectionWithinRange(feedbackSessionName, courseId, instructor.email, selectedSection, DEFAULT_SECTION_QUERY_RANGE));
} else if (Const.FeedbackSessionResults.RQG_SORT_TYPE.equals(sortType) || Const.FeedbackSessionResults.RGQ_SORT_TYPE.equals(sortType)) {
data.setBundle(logic.getFeedbackSessionResultsForInstructorToSectionWithinRange(feedbackSessionName, courseId, instructor.email, selectedSection, DEFAULT_SECTION_QUERY_RANGE));
}
if (data.getBundle() == null) {
throw new EntityDoesNotExistException("Feedback session " + feedbackSessionName + " does not exist in " + courseId + ".");
}
// Warning for section wise viewing in case of many responses.
boolean isShowSectionWarningForQuestionView = data.isLargeNumberOfRespondents() && Const.FeedbackSessionResults.QUESTION_SORT_TYPE.equals(sortType);
boolean isShowSectionWarningForParticipantView = !data.getBundle().isComplete && !Const.FeedbackSessionResults.QUESTION_SORT_TYPE.equals(sortType);
// Warning for section wise does not make sense if there are no multiple sections.
boolean isMultipleSectionAvailable = data.getBundle().getRosterSectionTeamNameTable().size() > 1;
if (selectedSection.equals(ALL_SECTION_OPTION) && (isShowSectionWarningForParticipantView || isShowSectionWarningForQuestionView)) {
if (isMultipleSectionAvailable) {
statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_RESULTS_SECTIONVIEWWARNING, StatusMessageColor.WARNING));
} else {
statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_RESULTS_QUESTIONVIEWWARNING, StatusMessageColor.WARNING));
}
isError = true;
}
switch(sortType) {
case Const.FeedbackSessionResults.QUESTION_SORT_TYPE:
data.initForViewByQuestion(instructor, selectedSection, showStats, groupByTeam, isMissingResponsesShown);
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_RESULTS_BY_QUESTION, data);
case Const.FeedbackSessionResults.RGQ_SORT_TYPE:
data.initForSectionPanelViews(instructor, selectedSection, showStats, groupByTeam, InstructorFeedbackResultsPageViewType.RECIPIENT_GIVER_QUESTION, isMissingResponsesShown);
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_RESULTS_BY_RECIPIENT_GIVER_QUESTION, data);
case Const.FeedbackSessionResults.GRQ_SORT_TYPE:
data.initForSectionPanelViews(instructor, selectedSection, showStats, groupByTeam, InstructorFeedbackResultsPageViewType.GIVER_RECIPIENT_QUESTION, isMissingResponsesShown);
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_RESULTS_BY_GIVER_RECIPIENT_QUESTION, data);
case Const.FeedbackSessionResults.RQG_SORT_TYPE:
data.initForSectionPanelViews(instructor, selectedSection, showStats, groupByTeam, InstructorFeedbackResultsPageViewType.RECIPIENT_QUESTION_GIVER, isMissingResponsesShown);
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_RESULTS_BY_RECIPIENT_QUESTION_GIVER, data);
case Const.FeedbackSessionResults.GQR_SORT_TYPE:
data.initForSectionPanelViews(instructor, selectedSection, showStats, groupByTeam, InstructorFeedbackResultsPageViewType.GIVER_QUESTION_RECIPIENT, isMissingResponsesShown);
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_RESULTS_BY_GIVER_QUESTION_RECIPIENT, data);
default:
sortType = Const.FeedbackSessionResults.RGQ_SORT_TYPE;
data.initForSectionPanelViews(instructor, selectedSection, showStats, groupByTeam, InstructorFeedbackResultsPageViewType.RECIPIENT_GIVER_QUESTION, isMissingResponsesShown);
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_RESULTS_BY_RECIPIENT_GIVER_QUESTION, data);
}
}
use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackSessionsPageAction method execute.
@Override
protected ActionResult execute() {
// This can be null. Non-null value indicates the page is being loaded
// to add a feedback to the specified course
String courseIdForNewSession = getRequestParamValue(Const.ParamsNames.COURSE_ID);
String feedbackSessionToHighlight = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
String isUsingAjax = getRequestParamValue(Const.ParamsNames.IS_USING_AJAX);
gateKeeper.verifyInstructorPrivileges(account);
if (courseIdForNewSession != null) {
gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(courseIdForNewSession, account.googleId), logic.getCourse(courseIdForNewSession), Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION);
}
InstructorFeedbackSessionsPageData data = new InstructorFeedbackSessionsPageData(account, sessionToken);
data.setUsingAjax(isUsingAjax != null);
// TODO: implement as a request parameter
boolean shouldOmitArchived = true;
// HashMap with courseId as key and InstructorAttributes as value
Map<String, InstructorAttributes> instructors = loadCourseInstructorMap(shouldOmitArchived);
List<InstructorAttributes> instructorList = new ArrayList<>(instructors.values());
List<CourseAttributes> courses = loadCoursesList(instructorList);
List<FeedbackSessionAttributes> existingFeedbackSessions;
if (courses.isEmpty() || !data.isUsingAjax()) {
existingFeedbackSessions = new ArrayList<>();
} else {
existingFeedbackSessions = loadFeedbackSessionsList(instructorList);
if (existingFeedbackSessions.isEmpty()) {
statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_SESSION_EMPTY, StatusMessageColor.WARNING));
}
}
if (courses.isEmpty()) {
statusToUser.add(new StatusMessage(Const.StatusMessages.COURSE_EMPTY_IN_INSTRUCTOR_FEEDBACKS.replace("${user}", "?user=" + account.googleId), StatusMessageColor.WARNING));
}
statusToAdmin = "Number of feedback sessions: " + existingFeedbackSessions.size();
data.initWithoutDefaultFormValues(courses, courseIdForNewSession, existingFeedbackSessions, instructors, feedbackSessionToHighlight);
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_SESSIONS, data);
}
Aggregations