* @param courseID
* the course ID (Pre-condition: The parameters must be valid)
*/
public void informStudentsOfChanges(List<Student> studentList,
String courseID, Date endTime) {
Queue queue = QueueFactory.getQueue("email-queue");
List<TaskOptions> taskOptionsList = new ArrayList<TaskOptions>();
DateFormat df = new SimpleDateFormat("dd/MM/yyyy HHmm");
TeamFormingSession teamFormingSession = getTeamFormingSession(courseID, endTime);
Date start = teamFormingSession.getStart();
Date deadline = teamFormingSession.getDeadline();
String instructions = teamFormingSession.getInstructions();
String profileTemplate = teamFormingSession.getProfileTemplate();
for (Student s : studentList) {
// There is a limit of 100 tasks per batch addition to Queue in
// Google App Engine
if (taskOptionsList.size() == 100) {
queue.add(taskOptionsList);
taskOptionsList = new ArrayList<TaskOptions>();
}
taskOptionsList.add(TaskOptions.Builder.withUrl("/email")
.param("operation", "informstudentsofevaluationchanges")
.param("email", s.getEmail()).param("name", s.getName())
.param("courseid", courseID)
.param("start", df.format(start))
.param("deadline", df.format(deadline))
.param("instr", instructions)
.param("profileTemplate", profileTemplate));
}
if (!taskOptionsList.isEmpty()) {
queue.add(taskOptionsList);
}
}