LOGGER.debug("Grading all students in section "
+ selectedSection.getName());
// Pull the Section from the Data Source to get the full list of
// Students
SectionDAO sectionDAO = new SectionDAO(emf.createEntityManager());
Section section = sectionDAO.find(selectedSection.getId());
sectionReport = new SectionReport(course.getName(), selectedInstructor,
section.getName(), selectedAssignment.getAssignment());
try
{
outputFile = new File(path + File.separator
+ selectedSection.getName() + dateStampString + ".html");
LOGGER.debug("Output File: " + outputFile.getCanonicalPath());
outputFile.createNewFile();
/**
* If a section is selected and there are multiple versions,
* pull the right one for the gevent variable...can we
* search the list and return the right one?
*/
if (multVersions)
{
/**
* If there are multiple versions of the GradedEvent,
* pull only the one for this section
*/
gevent = RageLib.getGradedEventFromSectionName(gevents,
selectedSection.getName());
}
// No else needed since if there are no multiple versions,
// gevent is already set above
} catch (FileNotFoundException ex)
{
// Do nothing...the file should be created if it's not there
} catch (IOException ex)
{
LOGGER.error("ERROR: IOException caught.");
LOGGER.error(ex.getLocalizedMessage());
}
for (Student studentIter : section.getStudents())
{
StudentReport studentReport = new StudentReport(studentIter, section);
// StudentReport studentReport = new StudentReport(studentIter);
String newPath = new String();
newPath = path.concat(File.separator);
newPath = newPath.concat(studentIter.getWebID());
LOGGER.debug("Path to grade: " + newPath);
statusMessageLabel.setText("Grading: " + studentIter.getLastName()
+ ", " + studentIter.getFirstName());
LOGGER.info("Grading: " + studentIter.getLastName() + ", "
+ studentIter.getFirstName());
File directory = new File(newPath);
launcher.directory(directory);
Runnable r = new GraderThread(node, launcher, directory, gevent,
studentReport, type);
grader_thread = new Thread(r);
grader_thread.start();
while (grader_thread.isAlive())
{
}
sectionReport.addStudentReport(studentReport);
}
sectionReport.sortStudentReports();
RageLib.printSectionReport(outputFile, sectionReport);
// Close the connection to the Data Source
sectionDAO.closeConnection();
} /**
* Just grade a single student
*/
else
{