use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.
the class CoursesLogic method getCourseStudentListAsCsv.
/**
* Returns a CSV for the details (name, email, status) of all students belonging to a given course.
*/
public String getCourseStudentListAsCsv(String courseId, String googleId) throws EntityDoesNotExistException {
Map<String, CourseDetailsBundle> courses = getCourseSummariesForInstructor(googleId, false);
CourseDetailsBundle course = courses.get(courseId);
boolean hasSection = hasIndicatedSections(courseId);
StringBuilder export = new StringBuilder(100);
String courseInfo = "Course ID," + SanitizationHelper.sanitizeForCsv(courseId) + System.lineSeparator() + "Course Name," + SanitizationHelper.sanitizeForCsv(course.course.getName()) + System.lineSeparator() + System.lineSeparator() + System.lineSeparator();
export.append(courseInfo);
String header = (hasSection ? "Section," : "") + "Team,Full Name,Last Name,Status,Email" + System.lineSeparator();
export.append(header);
for (SectionDetailsBundle section : course.sections) {
for (TeamDetailsBundle team : section.teams) {
for (StudentAttributes student : team.students) {
String studentStatus = null;
if (student.googleId == null || student.googleId.isEmpty()) {
studentStatus = Const.STUDENT_COURSE_STATUS_YET_TO_JOIN;
} else {
studentStatus = Const.STUDENT_COURSE_STATUS_JOINED;
}
if (hasSection) {
export.append(SanitizationHelper.sanitizeForCsv(section.name)).append(',');
}
export.append(SanitizationHelper.sanitizeForCsv(team.name) + ',' + SanitizationHelper.sanitizeForCsv(StringHelper.removeExtraSpace(student.name)) + ',' + SanitizationHelper.sanitizeForCsv(StringHelper.removeExtraSpace(student.lastName)) + ',' + SanitizationHelper.sanitizeForCsv(studentStatus) + ',' + SanitizationHelper.sanitizeForCsv(student.email) + System.lineSeparator());
}
}
}
return export.toString();
}
use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.
the class EmailGenerator method generateFeedbackSessionPublishedEmails.
/**
* Generates the feedback session published emails for the given {@code session}.
*/
public List<EmailWrapper> generateFeedbackSessionPublishedEmails(FeedbackSessionAttributes session) {
String template = EmailTemplates.USER_FEEDBACK_SESSION_PUBLISHED;
CourseAttributes course = coursesLogic.getCourse(session.getCourseId());
boolean isEmailNeeded = fsLogic.isFeedbackSessionViewableToStudents(session);
List<InstructorAttributes> instructors = isEmailNeeded ? instructorsLogic.getInstructorsForCourse(session.getCourseId()) : new ArrayList<InstructorAttributes>();
List<StudentAttributes> students = isEmailNeeded ? studentsLogic.getStudentsForCourse(session.getCourseId()) : new ArrayList<StudentAttributes>();
String additionalContactInformation = getAdditionalContactInformationFragment(course);
return generateFeedbackSessionEmailBases(course, session, students, instructors, template, EmailType.FEEDBACK_PUBLISHED.getSubject(), FEEDBACK_ACTION_VIEW, additionalContactInformation);
}
use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.
the class EmailGenerator method generateFeedbackSessionUnpublishedEmails.
/**
* Generates the feedback session published emails for the given {@code session}.
*/
public List<EmailWrapper> generateFeedbackSessionUnpublishedEmails(FeedbackSessionAttributes session) {
String template = EmailTemplates.USER_FEEDBACK_SESSION_UNPUBLISHED;
CourseAttributes course = coursesLogic.getCourse(session.getCourseId());
boolean isEmailNeeded = fsLogic.isFeedbackSessionViewableToStudents(session);
List<InstructorAttributes> instructors = isEmailNeeded ? instructorsLogic.getInstructorsForCourse(session.getCourseId()) : new ArrayList<InstructorAttributes>();
List<StudentAttributes> students = isEmailNeeded ? studentsLogic.getStudentsForCourse(session.getCourseId()) : new ArrayList<StudentAttributes>();
return generateFeedbackSessionEmailBases(course, session, students, instructors, template, EmailType.FEEDBACK_UNPUBLISHED.getSubject());
}
use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.
the class FeedbackSessionResultsBundle method getSortedListOfStudentEmails.
/**
* Returns a list of student emails, sorted by section name.
*/
private List<String> getSortedListOfStudentEmails() {
List<String> emailList = new ArrayList<>();
List<StudentAttributes> students = roster.getStudents();
StudentAttributes.sortBySectionName(students);
for (StudentAttributes student : students) {
emailList.add(student.email);
}
return emailList;
}
use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.
the class FeedbackSessionResultsBundle method getPossibleGivers.
/**
* Get the possible givers for a recipient specified by its participant identifier for
* a question.
*
* @return a list of participant identifiers that can give a response to the recipient specified
*/
public List<String> getPossibleGivers(FeedbackQuestionAttributes fqa, String recipientParticipantIdentifier) {
if (recipientParticipantIdentifier.contains("@@")) {
return new ArrayList<>();
}
if (isParticipantIdentifierStudent(recipientParticipantIdentifier)) {
StudentAttributes student = roster.getStudentForEmail(recipientParticipantIdentifier);
return getPossibleGivers(fqa, student);
} else if (isParticipantIdentifierInstructor(recipientParticipantIdentifier)) {
return getPossibleGivers(fqa);
} else if (recipientParticipantIdentifier.equals(Const.GENERAL_QUESTION)) {
switch(fqa.giverType) {
case STUDENTS:
return getSortedListOfStudentEmails();
case TEAMS:
return getSortedListOfTeams();
case INSTRUCTORS:
return getSortedListOfInstructorEmails();
case SELF:
List<String> creatorEmail = new ArrayList<>();
creatorEmail.add(fqa.creatorEmail);
return creatorEmail;
default:
log.severe("Invalid giver type specified");
return new ArrayList<>();
}
} else {
return getPossibleGiversForTeam(fqa, recipientParticipantIdentifier);
}
}
Aggregations