diff --git a/src/main/java/org/olat/ims/qti21/manager/QTI21ServiceImpl.java b/src/main/java/org/olat/ims/qti21/manager/QTI21ServiceImpl.java index aadf4ec80bfea5c3a0a1d222926571dacd79ef4a..595c2b17a594886aff38ae3eab22640472e6a4df 100644 --- a/src/main/java/org/olat/ims/qti21/manager/QTI21ServiceImpl.java +++ b/src/main/java/org/olat/ims/qti21/manager/QTI21ServiceImpl.java @@ -48,6 +48,7 @@ import javax.xml.transform.stream.StreamResult; import org.apache.commons.io.IOUtils; import org.olat.basesecurity.IdentityRef; +import org.olat.core.commons.persistence.DB; import org.olat.core.gui.components.form.flexible.impl.MultipartFileInfos; import org.olat.core.helpers.Settings; import org.olat.core.id.Identity; @@ -169,6 +170,8 @@ public class QTI21ServiceImpl implements QTI21Service, UserDataDeletable, Initia configXstream.alias("assessmentResultsOptions", QTI21AssessmentResultsOptions.class); } + @Autowired + private DB dbInstance; @Autowired private AssessmentTestSessionDAO testSessionDao; @Autowired @@ -430,12 +433,14 @@ public class QTI21ServiceImpl implements QTI21Service, UserDataDeletable, Initia @Override public boolean deleteAuthorAssessmentTestSession(RepositoryEntryRef testEntry) { + log.audit("Delete author assessment sessions for test: " + testEntry); List<AssessmentTestSession> sessions = testSessionDao.getAuthorAssessmentTestSession(testEntry); for(AssessmentTestSession session:sessions) { File fileStorage = testSessionDao.getSessionStorage(session); testSessionDao.deleteTestSession(session); FileUtils.deleteDirsAndFiles(fileStorage, true, true); } + dbInstance.commit();// make sure it's flushed on the database return true; } diff --git a/src/main/java/org/olat/ims/qti21/ui/AssessmentTestDisplayController.java b/src/main/java/org/olat/ims/qti21/ui/AssessmentTestDisplayController.java index e84ac06760d149a9ff4701a39b8e95efd375b29c..3f7516800a976ccff27c74d9e31b4b89691dbeeb 100644 --- a/src/main/java/org/olat/ims/qti21/ui/AssessmentTestDisplayController.java +++ b/src/main/java/org/olat/ims/qti21/ui/AssessmentTestDisplayController.java @@ -280,7 +280,7 @@ public class AssessmentTestDisplayController extends BasicController implements candidateSession.setExploded(true); candidateSession = qtiService.updateAssessmentTestSession(candidateSession); } else { - qtiService.finishTestSession(candidateSession, testSessionController.getTestSessionState(), assessmentResult, + candidateSession = qtiService.finishTestSession(candidateSession, testSessionController.getTestSessionState(), assessmentResult, currentRequestTimestamp, getDigitalSignatureOptions(), getIdentity()); } } @@ -1422,7 +1422,7 @@ public class AssessmentTestDisplayController extends BasicController implements /* Handle immediate end of test session */ if (ended) { - qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult, + candidateSession = qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult, timestamp, getDigitalSignatureOptions(), getIdentity()); } else { TestPart currentTestPart = testSessionController.getCurrentTestPart();