use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.
the class InstructorStudentRecordsAjaxPageAction method execute.
@Override
public ActionResult execute() throws EntityDoesNotExistException {
String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId);
String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL);
Assumption.assertPostParamNotNull(Const.ParamsNames.STUDENT_EMAIL, studentEmail);
String targetSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME, targetSessionName);
InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId);
gateKeeper.verifyAccessible(instructor, logic.getCourse(courseId));
StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail);
if (student == null) {
statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_NOT_FOUND_FOR_RECORDS, StatusMessageColor.DANGER));
isError = true;
return createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE);
}
List<FeedbackSessionAttributes> feedbacks = logic.getFeedbackSessionsListForInstructor(account.googleId, false);
filterFeedbackSessions(courseId, feedbacks, instructor, student);
List<SessionAttributes> sessions = new ArrayList<>();
sessions.addAll(feedbacks);
sessions.sort(SessionAttributes.DESCENDING_ORDER);
List<FeedbackSessionResultsBundle> results = new ArrayList<>();
for (SessionAttributes session : sessions) {
if (session instanceof FeedbackSessionAttributes) {
if (!targetSessionName.isEmpty() && targetSessionName.equals(session.getSessionName())) {
FeedbackSessionResultsBundle result = logic.getFeedbackSessionResultsForInstructor(session.getSessionName(), courseId, instructor.email);
results.add(result);
}
} else {
Assumption.fail("Unknown session type");
}
}
statusToAdmin = "instructorStudentRecords Ajax Page Load<br>" + "Viewing <span class=\"bold\">" + studentEmail + "'s</span> records " + "for session <span class=\"bold\">[" + targetSessionName + "]</span> " + "in course <span class=\"bold\">[" + courseId + "]</span>";
InstructorStudentRecordsAjaxPageData data = new InstructorStudentRecordsAjaxPageData(account, student, sessionToken, results);
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_STUDENT_RECORDS_AJAX, data);
}
use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.
the class BackDoorLogic method editStudentAsJson.
public void editStudentAsJson(String originalEmail, String newValues) throws InvalidParametersException, EntityDoesNotExistException {
StudentAttributes student = JsonUtils.fromJson(newValues, StudentAttributes.class);
populateNullSection(student);
updateStudentWithoutDocument(originalEmail, student);
}
use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.
the class BackDoorLogic method processStudentsAndPopulateAccounts.
private void processStudentsAndPopulateAccounts(Collection<StudentAttributes> students, Map<String, AccountAttributes> googleIdAccountMap) {
for (StudentAttributes student : students) {
populateNullSection(student);
if (StringHelper.isEmpty(student.googleId) || googleIdAccountMap.containsKey(student.googleId)) {
// or instructor account already exists (i.e. instructor is also a student)
continue;
}
googleIdAccountMap.put(student.googleId, makeAccount(student));
}
}
use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.
the class BackDoorLogic method putDocuments.
/**
* Creates document for entities that have document, i.e. searchable.
* @return status of the request in the form 'status meassage'+'additional
* info (if any)' e.g., "[BACKEND_STATUS_SUCCESS]" e.g.,
* "[BACKEND_STATUS_FAILURE]NullPointerException at ..."
*/
public String putDocuments(DataBundle dataBundle) {
// query the entity in db first to get the actual data and create document for actual entity
Map<String, StudentAttributes> students = dataBundle.students;
for (StudentAttributes student : students.values()) {
StudentAttributes studentInDb = studentsDb.getStudentForEmail(student.course, student.email);
studentsDb.putDocument(studentInDb);
}
Map<String, InstructorAttributes> instructors = dataBundle.instructors;
for (InstructorAttributes instructor : instructors.values()) {
InstructorAttributes instructorInDb = instructorsDb.getInstructorForEmail(instructor.courseId, instructor.email);
instructorsDb.putDocument(instructorInDb);
}
Map<String, FeedbackResponseCommentAttributes> responseComments = dataBundle.feedbackResponseComments;
for (FeedbackResponseCommentAttributes responseComment : responseComments.values()) {
FeedbackResponseCommentAttributes fcInDb = fcDb.getFeedbackResponseComment(responseComment.courseId, responseComment.createdAt, responseComment.giverEmail);
fcDb.putDocument(fcInDb);
}
return Const.StatusCodes.BACKDOOR_STATUS_SUCCESS;
}
use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.
the class AccountsLogic method joinCourseForStudent.
public void joinCourseForStudent(String registrationKey, String googleId) throws JoinCourseException, InvalidParametersException {
verifyStudentJoinCourseRequest(registrationKey, googleId);
StudentAttributes student = studentsLogic.getStudentForRegistrationKey(registrationKey);
// register the student
student.googleId = googleId;
try {
studentsLogic.updateStudentCascade(student.email, student);
} catch (EntityDoesNotExistException e) {
Assumption.fail("Student disappered while trying to register " + TeammatesException.toStringWithStackTrace(e));
}
if (accountsDb.getAccount(googleId) == null) {
createStudentAccount(student);
}
}
Aggregations