use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class InstructorStudentListPageAction method execute.
@Override
public ActionResult execute() {
gateKeeper.verifyInstructorPrivileges(account);
String searchKey = getRequestParamValue(Const.ParamsNames.SEARCH_KEY);
Boolean displayArchive = getRequestParamAsBoolean(Const.ParamsNames.DISPLAY_ARCHIVE);
Map<String, InstructorAttributes> instructors = new HashMap<>();
List<CourseAttributes> courses = logic.getCoursesForInstructor(account.googleId);
// Sort by creation date
courses.sort(Comparator.comparing(course -> course.createdAt));
// Get instructor attributes
List<InstructorAttributes> instructorList = logic.getInstructorsForGoogleId(account.googleId);
for (InstructorAttributes instructor : instructorList) {
instructors.put(instructor.courseId, instructor);
}
if (courses.isEmpty()) {
statusToUser.add(new StatusMessage(Const.StatusMessages.INSTRUCTOR_NO_COURSE_AND_STUDENTS, StatusMessageColor.WARNING));
}
statusToAdmin = "instructorStudentList Page Load<br>" + "Total Courses: " + courses.size();
List<InstructorStudentListPageCourseData> coursesToDisplay = new ArrayList<>();
for (CourseAttributes course : courses) {
InstructorAttributes instructor = instructors.get(course.getId());
boolean isInstructorAllowedToModify = instructor.isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT);
boolean isCourseDisplayed = displayArchive || !instructor.isArchived;
if (isCourseDisplayed) {
coursesToDisplay.add(new InstructorStudentListPageCourseData(course, instructor.isArchived, isInstructorAllowedToModify));
}
}
InstructorStudentListPageData data = new InstructorStudentListPageData(account, sessionToken, searchKey, displayArchive, coursesToDisplay);
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_STUDENT_LIST, data);
}
use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class CoursesLogic method getCourseSummaryWithoutStatsForInstructor.
private Map<String, CourseSummaryBundle> getCourseSummaryWithoutStatsForInstructor(List<InstructorAttributes> instructorAttributesList) {
HashMap<String, CourseSummaryBundle> courseSummaryList = new HashMap<>();
List<String> courseIdList = new ArrayList<>();
for (InstructorAttributes ia : instructorAttributesList) {
courseIdList.add(ia.courseId);
}
List<CourseAttributes> courseList = coursesDb.getCourses(courseIdList);
// Check that all courseIds queried returned a course.
if (courseIdList.size() > courseList.size()) {
for (CourseAttributes ca : courseList) {
courseIdList.remove(ca.getId());
}
log.severe("Course(s) was deleted but the instructor still exists: " + System.lineSeparator() + courseIdList.toString());
}
for (CourseAttributes ca : courseList) {
courseSummaryList.put(ca.getId(), getCourseSummaryWithoutStats(ca));
}
return courseSummaryList;
}
use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class CoursesLogic method getCoursesForInstructor.
/**
* Returns a list of {@link CourseAttributes} for all courses for a given list of instructors.
*/
public List<CourseAttributes> getCoursesForInstructor(List<InstructorAttributes> instructorList) {
Assumption.assertNotNull("Supplied parameter was null", instructorList);
List<String> courseIdList = new ArrayList<>();
for (InstructorAttributes instructor : instructorList) {
courseIdList.add(instructor.courseId);
}
List<CourseAttributes> courseList = coursesDb.getCourses(courseIdList);
// Check that all courseIds queried returned a course.
if (courseIdList.size() > courseList.size()) {
for (CourseAttributes ca : courseList) {
courseIdList.remove(ca.getId());
}
log.severe("Course(s) was deleted but the instructor still exists: " + System.lineSeparator() + courseIdList.toString());
}
return courseList;
}
use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class EmailGenerator method generateFeedbackSubmissionConfirmationEmailForStudent.
/**
* Generates the feedback submission confirmation email for the given {@code session} for {@code student}.
*/
public EmailWrapper generateFeedbackSubmissionConfirmationEmailForStudent(FeedbackSessionAttributes session, StudentAttributes student, Instant timestamp) {
CourseAttributes course = coursesLogic.getCourse(session.getCourseId());
String submitUrl = Config.getAppUrl(Const.ActionURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT_PAGE).withCourseId(course.getId()).withSessionName(session.getFeedbackSessionName()).withRegistrationKey(StringHelper.encrypt(student.key)).withStudentEmail(student.email).toAbsoluteString();
return generateSubmissionConfirmationEmail(course, session, submitUrl, student.name, student.email, timestamp);
}
use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class EmailGenerator method generateFeedbackSessionReminderEmails.
/**
* Generates the feedback session reminder emails for the given {@code session} for {@code students}
* and {@code instructorsToRemind}. In addition, the emails will also be forwarded to {@code instructorsToNotify}.
*/
public List<EmailWrapper> generateFeedbackSessionReminderEmails(FeedbackSessionAttributes session, List<StudentAttributes> students, List<InstructorAttributes> instructorsToRemind, InstructorAttributes instructorToNotify) {
CourseAttributes course = coursesLogic.getCourse(session.getCourseId());
String template = EmailTemplates.USER_FEEDBACK_SESSION.replace("${status}", FEEDBACK_STATUS_SESSION_OPEN);
String additionalContactInformation = HTML_NO_ACTION_REQUIRED + getAdditionalContactInformationFragment(course);
List<InstructorAttributes> instructorToNotifyAsList = new ArrayList<>();
instructorToNotifyAsList.add(instructorToNotify);
List<EmailWrapper> emails = generateFeedbackSessionEmailBasesForInstructorReminders(course, session, instructorsToRemind, template, EmailType.FEEDBACK_SESSION_REMINDER.getSubject(), additionalContactInformation);
emails.addAll(generateFeedbackSessionEmailBases(course, session, students, instructorToNotifyAsList, template, EmailType.FEEDBACK_SESSION_REMINDER.getSubject(), FEEDBACK_ACTION_SUBMIT, additionalContactInformation));
return emails;
}
Aggregations