use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class StudentHomePageAction method execute.
@Override
public ActionResult execute() {
gateKeeper.verifyLoggedInUserPrivileges();
String recentlyJoinedCourseId = getRequestParamValue(Const.ParamsNames.CHECK_PERSISTENCE_COURSE);
List<CourseDetailsBundle> courses = new ArrayList<>();
Map<FeedbackSessionAttributes, Boolean> sessionSubmissionStatusMap = new HashMap<>();
try {
courses = logic.getCourseDetailsListForStudent(account.googleId);
sessionSubmissionStatusMap = generateFeedbackSessionSubmissionStatusMap(courses, account.googleId);
CourseDetailsBundle.sortDetailedCoursesByCourseId(courses);
statusToAdmin = "studentHome Page Load<br>" + "Total courses: " + courses.size();
boolean isDataConsistent = isCourseIncluded(recentlyJoinedCourseId, courses);
if (!isDataConsistent) {
addPlaceholderCourse(courses, recentlyJoinedCourseId, sessionSubmissionStatusMap);
}
for (CourseDetailsBundle course : courses) {
FeedbackSessionDetailsBundle.sortFeedbackSessionsByCreationTime(course.feedbackSessions);
}
} catch (EntityDoesNotExistException e) {
if (recentlyJoinedCourseId == null) {
statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_FIRST_TIME, StatusMessageColor.WARNING));
statusToAdmin = Const.ACTION_RESULT_FAILURE + " :" + e.getMessage();
} else {
addPlaceholderCourse(courses, recentlyJoinedCourseId, sessionSubmissionStatusMap);
}
}
StudentHomePageData data = new StudentHomePageData(account, sessionToken, courses, sessionSubmissionStatusMap);
return createShowPageResult(Const.ViewURIs.STUDENT_HOME, data);
}
use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class StudentHomePageData method createSessionRows.
private List<HomeFeedbackSessionRow> createSessionRows(List<FeedbackSessionDetailsBundle> feedbackSessions, Map<FeedbackSessionAttributes, Boolean> sessionSubmissionStatusMap, int startingSessionIdx) {
List<HomeFeedbackSessionRow> rows = new ArrayList<>();
int sessionIdx = startingSessionIdx;
for (FeedbackSessionDetailsBundle session : feedbackSessions) {
FeedbackSessionAttributes feedbackSession = session.feedbackSession;
String sessionName = feedbackSession.getFeedbackSessionName();
boolean hasSubmitted = sessionSubmissionStatusMap.get(feedbackSession);
rows.add(new StudentHomeFeedbackSessionRow(PageData.sanitizeForHtml(sessionName), getStudentSubmissionsTooltipForSession(feedbackSession, hasSubmitted), getStudentPublishedTooltipForSession(feedbackSession), getStudentSubmissionStatusForSession(feedbackSession, hasSubmitted), getStudentPublishedStatusForSession(feedbackSession), TimeHelper.formatDateTimeForSessions(feedbackSession.getEndTime(), feedbackSession.getTimeZone()), feedbackSession.getEndTimeInIso8601UtcFormat(), getStudentFeedbackSessionActions(feedbackSession, hasSubmitted), sessionIdx));
++sessionIdx;
}
return rows;
}
use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class FeedbackSessionsLogic method deleteInstructorRespondent.
public void deleteInstructorRespondent(String email, String feedbackSessionName, String courseId) throws EntityDoesNotExistException, InvalidParametersException {
Assumption.assertNotNull(Const.StatusCodes.NULL_PARAMETER, feedbackSessionName);
Assumption.assertNotNull(Const.StatusCodes.NULL_PARAMETER, courseId);
Assumption.assertNotNull(Const.StatusCodes.NULL_PARAMETER, email);
FeedbackSessionAttributes sessionToUpdate = getFeedbackSession(feedbackSessionName, courseId);
if (sessionToUpdate == null) {
throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_FS_UPDATE + courseId + "/" + feedbackSessionName);
}
fsDb.deleteInstructorRespondent(email, sessionToUpdate);
}
use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class FeedbackSessionsLogic method updateFeedbackSession.
public void updateFeedbackSession(FeedbackSessionAttributes newSession) throws InvalidParametersException, EntityDoesNotExistException {
Assumption.assertNotNull(Const.StatusCodes.NULL_PARAMETER, newSession);
FeedbackSessionAttributes oldSession = fsDb.getFeedbackSession(newSession.getCourseId(), newSession.getFeedbackSessionName());
if (oldSession == null) {
throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_FS_UPDATE + newSession.getCourseId() + "/" + newSession.getFeedbackSessionName());
}
// These can't be changed anyway. Copy values to defensively avoid
// invalid parameters.
newSession.setCreatorEmail(oldSession.getCreatorEmail());
newSession.setCreatedTime(oldSession.getCreatedTime());
if (newSession.getInstructions() == null) {
newSession.setInstructions(oldSession.getInstructions());
}
if (newSession.getStartTime() == null) {
newSession.setStartTime(oldSession.getStartTime());
}
if (newSession.getEndTime() == null) {
newSession.setEndTime(oldSession.getEndTime());
}
if (newSession.getFeedbackSessionType() == null) {
newSession.setFeedbackSessionType(oldSession.getFeedbackSessionType());
}
if (newSession.getSessionVisibleFromTime() == null) {
newSession.setSessionVisibleFromTime(oldSession.getSessionVisibleFromTime());
}
if (newSession.getResultsVisibleFromTime() == null) {
newSession.setResultsVisibleFromTime(oldSession.getResultsVisibleFromTime());
}
makeEmailStateConsistent(oldSession, newSession);
fsDb.updateFeedbackSession(newSession);
}
use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class FeedbackSessionsLogic method updateRespondentsForSession.
public void updateRespondentsForSession(String feedbackSessionName, String courseId) throws InvalidParametersException, EntityDoesNotExistException {
clearInstructorRespondents(feedbackSessionName, courseId);
clearStudentRespondents(feedbackSessionName, courseId);
FeedbackSessionAttributes fsa = getFeedbackSession(feedbackSessionName, courseId);
List<FeedbackQuestionAttributes> questions = fqLogic.getFeedbackQuestionsForSession(feedbackSessionName, courseId);
List<InstructorAttributes> instructors = instructorsLogic.getInstructorsForCourse(courseId);
Map<String, List<String>> instructorQuestionsMap = new HashMap<>();
for (InstructorAttributes instructor : instructors) {
List<FeedbackQuestionAttributes> instructorQns = fqLogic.getFeedbackQuestionsForInstructor(questions, fsa.isCreator(instructor.email));
if (!instructorQns.isEmpty()) {
List<String> questionIds = new ArrayList<>();
for (FeedbackQuestionAttributes question : instructorQns) {
questionIds.add(question.getId());
}
instructorQuestionsMap.put(instructor.email, questionIds);
}
}
Set<String> respondingStudentList = new HashSet<>();
Set<String> respondingInstructorList = new HashSet<>();
List<FeedbackResponseAttributes> responses = frLogic.getFeedbackResponsesForSession(feedbackSessionName, courseId);
for (FeedbackResponseAttributes response : responses) {
List<String> instructorQuestions = instructorQuestionsMap.get(response.giver);
if (instructorQuestions != null && instructorQuestions.contains(response.feedbackQuestionId)) {
respondingInstructorList.add(response.giver);
} else {
respondingStudentList.add(response.giver);
}
}
addInstructorRespondents(new ArrayList<>(respondingInstructorList), feedbackSessionName, courseId);
addStudentRespondents(new ArrayList<>(respondingStudentList), feedbackSessionName, courseId);
}
Aggregations