Collection<Qualificationgroup> qgs = qualificationgroupDAO.read();
for (Iterator<Qualificationgroup> qualificationgroup = qgs.iterator(); qualificationgroup
.hasNext();) {
QualificationgroupModulesStudent qms = new QualificationgroupModulesStudent();
Qualificationgroup qg = qualificationgroup.next();
qms.setQualificationgroup(qg);
/*
* only for TESTING:works fine Collection<StudentModule> smtest =
* studentModuleDAO.read();
*/
/*
* ONLY FOR TESTING, doens't work yet: for (Iterator<StudentModule>
* sm1 = sms.iterator(); sm1.hasNext();) { StudentModule sm =
* sm1.next(); System.out.println("id " + sm.getId()); }
*/
int ects = 0;
int booked_ects = 0;
Collection<StudentModule> smList = new LinkedList<StudentModule>();
for (StudentModule sm : currentStudent.getStudentModules()) {
if (sm.getModule().getQualificationgroup().equals(qg)) {
smList.add(sm);
// add to current ects for qualificationgroup
if (sm.getState().equals("PASS"))
ects += sm.getModule().getEcts();
booked_ects += sm.getModule().getEcts();
// add for the whole total of ects
if (sm.getState().equals("PASS"))
this.tot_ects += sm.getModule().getEcts();
this.tot_booked_ects += sm.getModule().getEcts();
// System.out.println("Add SM " + sm.getModule().getName()
// + " in group: "
// + sm.getModule().getQualificationgroup().getName()
// + " ects " + sm.getModule().getEcts());
// System.out.println("tot etcs " + this.tot_ects);
}
}
qms.setStudentModules(smList);
qms.setEcts(ects);
qms.setBooked_ects(booked_ects);
qmsList.add(qms);
}
}