use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class StudentCourseJoinAuthenticatedAction method addStatusMessageToUser.
private void addStatusMessageToUser() throws EntityDoesNotExistException {
CourseAttributes course = logic.getCourse(getStudent().course);
String courseDisplayText = "[" + course.getId() + "] " + SanitizationHelper.sanitizeForHtml(course.getName());
statusToUser.add(new StatusMessage(String.format(Const.StatusMessages.STUDENT_COURSE_JOIN_SUCCESSFUL, courseDisplayText), StatusMessageColor.SUCCESS));
List<FeedbackSessionAttributes> fsa = logic.getFeedbackSessionsForUserInCourse(getStudent().course, getStudent().email);
if (fsa.isEmpty()) {
statusToUser.add(new StatusMessage(String.format(Const.StatusMessages.HINT_FOR_NO_SESSIONS_STUDENT, courseDisplayText), StatusMessageColor.INFO));
StudentProfileAttributes spa = logic.getStudentProfile(account.googleId);
String updateProfileMessage = spa.generateUpdateMessageForStudent();
if (!updateProfileMessage.isEmpty()) {
statusToUser.add(new StatusMessage(updateProfileMessage, StatusMessageColor.INFO));
}
}
}
use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class AdminAccountDetailsPageData method createStudentCourseListTable.
private List<AdminAccountDetailsStudentCourseListTableRow> createStudentCourseListTable(List<CourseAttributes> studentCourseList) {
List<AdminAccountDetailsStudentCourseListTableRow> courseListTable = new ArrayList<>();
if (studentCourseList != null) {
for (CourseAttributes courseDetails : studentCourseList) {
AdminAccountDetailsStudentCourseListTableRow row = new AdminAccountDetailsStudentCourseListTableRow(accountInformation.googleId, courseDetails, getSessionToken());
courseListTable.add(row);
}
}
return courseListTable;
}
use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class StudentCourseJoinEmailWorkerAction method execute.
@Override
public void execute() {
String courseId = getRequestParamValue(ParamsNames.COURSE_ID);
Assumption.assertPostParamNotNull(ParamsNames.COURSE_ID, courseId);
String studentEmail = getRequestParamValue(ParamsNames.STUDENT_EMAIL);
Assumption.assertPostParamNotNull(ParamsNames.STUDENT_EMAIL, studentEmail);
String isRejoinString = getRequestParamValue(ParamsNames.IS_STUDENT_REJOINING);
Assumption.assertPostParamNotNull(ParamsNames.IS_STUDENT_REJOINING, isRejoinString);
boolean isRejoin = Boolean.parseBoolean(isRejoinString);
CourseAttributes course = logic.getCourse(courseId);
Assumption.assertNotNull(course);
StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail);
Assumption.assertNotNull(student);
EmailWrapper email = isRejoin ? new EmailGenerator().generateStudentCourseRejoinEmailAfterGoogleIdReset(course, student) : new EmailGenerator().generateStudentCourseJoinEmail(course, student);
try {
emailSender.sendEmail(email);
} catch (Exception e) {
Assumption.fail("Unexpected error while sending email" + TeammatesException.toStringWithStackTrace(e));
}
}
use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class AdminAccountDetailsPageAction method execute.
@Override
protected ActionResult execute() {
gateKeeper.verifyAdminPrivileges(account);
String googleId = getRequestParamValue(Const.ParamsNames.INSTRUCTOR_ID);
AccountAttributes accountInformation = logic.getAccount(googleId);
List<CourseDetailsBundle> instructorCourseList;
try {
instructorCourseList = new ArrayList<>(logic.getCourseSummariesForInstructor(googleId).values());
} catch (EntityDoesNotExistException e) {
// Not an instructor of any course
instructorCourseList = null;
}
List<CourseAttributes> studentCourseList;
try {
studentCourseList = logic.getCoursesForStudentAccount(googleId);
} catch (EntityDoesNotExistException e) {
// Not a student of any course
studentCourseList = null;
}
AdminAccountDetailsPageData data = new AdminAccountDetailsPageData(account, sessionToken, accountInformation, instructorCourseList, studentCourseList);
statusToAdmin = "adminAccountDetails Page Load<br>" + "Viewing details for " + data.getAccountInformation().name + "(" + googleId + ")";
return createShowPageResult(Const.ViewURIs.ADMIN_ACCOUNT_DETAILS, data);
}
use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class FeedbackSessionsLogicTest method testCopyFeedbackSession.
private void testCopyFeedbackSession() throws Exception {
______TS("Test copy");
FeedbackSessionAttributes session1InCourse1 = dataBundle.feedbackSessions.get("session1InCourse1");
InstructorAttributes instructor2OfCourse1 = dataBundle.instructors.get("instructor2OfCourse1");
CourseAttributes typicalCourse2 = dataBundle.courses.get("typicalCourse2");
FeedbackSessionAttributes copiedSession = fsLogic.copyFeedbackSession("Copied Session", typicalCourse2.getId(), session1InCourse1.getFeedbackSessionName(), session1InCourse1.getCourseId(), instructor2OfCourse1.email);
verifyPresentInDatastore(copiedSession);
assertEquals("Copied Session", copiedSession.getFeedbackSessionName());
assertEquals(typicalCourse2.getId(), copiedSession.getCourseId());
List<FeedbackQuestionAttributes> questions1 = fqLogic.getFeedbackQuestionsForSession(session1InCourse1.getFeedbackSessionName(), session1InCourse1.getCourseId());
List<FeedbackQuestionAttributes> questions2 = fqLogic.getFeedbackQuestionsForSession(copiedSession.getFeedbackSessionName(), copiedSession.getCourseId());
assertEquals(questions1.size(), questions2.size());
for (int i = 0; i < questions1.size(); i++) {
FeedbackQuestionAttributes question1 = questions1.get(i);
FeedbackQuestionDetails questionDetails1 = question1.getQuestionDetails();
FeedbackQuestionAttributes question2 = questions2.get(i);
FeedbackQuestionDetails questionDetails2 = question2.getQuestionDetails();
assertEquals(questionDetails1.getQuestionText(), questionDetails2.getQuestionText());
assertEquals(question1.giverType, question2.giverType);
assertEquals(question1.recipientType, question2.recipientType);
assertEquals(question1.questionType, question2.questionType);
assertEquals(question1.numberOfEntitiesToGiveFeedbackTo, question2.numberOfEntitiesToGiveFeedbackTo);
}
assertEquals(0, copiedSession.getRespondingInstructorList().size());
assertEquals(0, copiedSession.getRespondingStudentList().size());
______TS("Failure case: duplicate session");
try {
fsLogic.copyFeedbackSession(session1InCourse1.getFeedbackSessionName(), session1InCourse1.getCourseId(), session1InCourse1.getFeedbackSessionName(), session1InCourse1.getCourseId(), instructor2OfCourse1.email);
signalFailureToDetectException();
} catch (EntityAlreadyExistsException e) {
ignoreExpectedException();
}
fsLogic.deleteFeedbackSessionCascade(copiedSession.getFeedbackSessionName(), copiedSession.getCourseId());
}
Aggregations