From 570970eef08f8be6532525dc543974b7d26964b5 Mon Sep 17 00:00:00 2001
From: srosse <none@none>
Date: Fri, 6 Apr 2018 13:23:50 +0200
Subject: [PATCH] OO-3422: submit the test if the session is ended in case of
 finish linear event

---
 .../qti21/ui/AssessmentTestDisplayController.java  | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

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 4fa678097fd..2eb6621cd5e 100644
--- a/src/main/java/org/olat/ims/qti21/ui/AssessmentTestDisplayController.java
+++ b/src/main/java/org/olat/ims/qti21/ui/AssessmentTestDisplayController.java
@@ -955,27 +955,21 @@ public class AssessmentTestDisplayController extends BasicController implements
 				logError("CANNOT_FINISH_LINEAR_TEST_ITEM", null);
                 return;
             }
-		} catch (QtiCandidateStateException e) {
-            candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_FINISH_LINEAR_TEST_ITEM, e);
-         	logError("CANNOT_FINISH_LINEAR_TEST_ITEM", e);
-         	return;
 		} catch (RuntimeException e) {
 			candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_FINISH_LINEAR_TEST_ITEM, e);
          	logError("CANNOT_FINISH_LINEAR_TEST_ITEM", e);
-			return;// handleExplosion(e, candidateSession);
+			return;
 		}
 		 
 		// Update state
 		final Date requestTimestamp = ureq.getRequestTimestamp();
 	    final TestPlanNode nextItemNode = testSessionController.advanceItemLinear(requestTimestamp);
 	    
-	    //boolean terminated = nextItemNode == null && testSessionController.findNextEnterableTestPart() == null; 
-
+	    boolean terminated = nextItemNode == null && testSessionController.findNextEnterableTestPart() == null;
 	    // Record current result state
-	    final AssessmentResult assessmentResult = computeAndRecordTestAssessmentResult(requestTimestamp, testSessionState, false);
-
+	    final AssessmentResult assessmentResult = computeAndRecordTestAssessmentResult(requestTimestamp, testSessionState, terminated);
 	    /* If we ended the testPart and there are now no more available testParts, then finish the session now */
-	    if (nextItemNode==null && testSessionController.findNextEnterableTestPart()==null) {
+	    if (terminated) {
 	    		candidateSession = qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult,
 	    			requestTimestamp, getDigitalSignatureOptions(), getIdentity());
 	    }
-- 
GitLab