String courseID = req.getParameter(COURSE_ID);
String evaluationName = req.getParameter(EVALUATION_NAME);
// fromStudent is the Student's email
Courses courses = Courses.inst();
Student student = courses.getStudentWithID(courseID, googleID);
String fromStudent = student.getEmail();
String fromStudentName = student.getName();
// wangsha
// should be historical teamname, not the latest one
String teamName = student.getTeamName();
Evaluations evaluations = Evaluations.inst();
List<Submission> submissionList = evaluations
.getSubmissionFromStudentList(courseID, evaluationName,
fromStudent);
List<SubmissionDetailsForStudent> submissionDetailsList = new ArrayList<SubmissionDetailsForStudent>();
for (Submission s : submissionList) {
student = courses.getStudentWithEmail(courseID, s.getToStudent());
// huy - Fix when student is already deleted.
if (student == null) {
student = new Student();
student.setEmail(s.getToStudent());
student.setName("[deleted]" + student.getEmail());
}
// Always return the student's own submission first
if (s.getToStudent().equals(fromStudent)) {
submissionDetailsList.add(
0,
new SubmissionDetailsForStudent(courseID,
evaluationName, fromStudentName, student
.getName(), fromStudent, student
.getEmail(), s.getTeamName(), s
.getPoints(), s.getJustification(), s
.getCommentsToStudent()));
}
else {
submissionDetailsList.add(new SubmissionDetailsForStudent(
courseID, evaluationName, fromStudentName, student
.getName(), fromStudent, student.getEmail(), s
.getTeamName(), s.getPoints(), s
.getJustification(), s.getCommentsToStudent()));
}
}