diff --git a/src/main/java/org/olat/core/util/resource/WindowedResourceableList.java b/src/main/java/org/olat/core/util/resource/WindowedResourceableList.java index c70ded5649fb61b48d13213dd278907947924e26..bc87aac10d48e420176382342b2b73445b8b83f8 100644 --- a/src/main/java/org/olat/core/util/resource/WindowedResourceableList.java +++ b/src/main/java/org/olat/core/util/resource/WindowedResourceableList.java @@ -24,8 +24,10 @@ import java.util.Collection; import java.util.Collections; import java.util.Deque; +import org.apache.logging.log4j.Logger; import org.olat.core.gui.components.Window; import org.olat.core.id.OLATResourceable; +import org.olat.core.logging.Tracing; /** * @@ -34,6 +36,8 @@ import org.olat.core.id.OLATResourceable; * */ public class WindowedResourceableList { + + private static final Logger log = Tracing.createLoggerFor(WindowedResourceableList.class); private final Deque<WindowedResourceable> registeredResources = new ArrayDeque<>(); @@ -61,9 +65,12 @@ public class WindowedResourceableList { } public synchronized void deregisterResourceable(OLATResourceable resource, String subIdent, Window window) { - WindowedResourceable wResource = new WindowedResourceable(window.getInstanceId(), resource, subIdent); - Collection<WindowedResourceable> wResources = Collections.singletonList(wResource); - registeredResources.removeAll(wResources); + try { + WindowedResourceable wResource = new WindowedResourceable(window.getInstanceId(), resource, subIdent); + Collection<WindowedResourceable> wResources = Collections.singletonList(wResource); + registeredResources.removeAll(wResources); + } catch (Exception e) { + log.error("", e); + } } - } 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 e7d0de288cd120fba811e05bb1b63fb9af7d7f4e..fb1293c7ae8871fb4264b7cc9fc38a73450641d0 100644 --- a/src/main/java/org/olat/ims/qti21/ui/AssessmentTestDisplayController.java +++ b/src/main/java/org/olat/ims/qti21/ui/AssessmentTestDisplayController.java @@ -574,10 +574,12 @@ public class AssessmentTestDisplayController extends BasicController implements } private void doExitTest(UserRequest ureq) { + resourcesList.deregisterResourceable(entry, subIdent, getWindow()); fireEvent(ureq, new QTI21Event(QTI21Event.EXIT)); } private void doCloseResults(UserRequest ureq) { + resourcesList.deregisterResourceable(entry, subIdent, getWindow()); fireEvent(ureq, new QTI21Event(QTI21Event.CLOSE_RESULTS)); } @@ -593,6 +595,7 @@ public class AssessmentTestDisplayController extends BasicController implements VelocityContainer suspendedVC = createVelocityContainer("suspended"); mainPanel.setContent(suspendedVC); suspendAssessmentTest(ureq.getRequestTimestamp()); + resourcesList.deregisterResourceable(entry, subIdent, getWindow()); fireEvent(ureq, new Event("suspend")); } @@ -816,7 +819,9 @@ public class AssessmentTestDisplayController extends BasicController implements testSessionController = qtiService.getCachedTestSessionController(candidateSession, testSessionController); testSessionController.setCurrentRequestTimestamp(ureq.getRequestTimestamp()); - if(timeLimitBarrier(ureq) || sessionReseted(ureq) || sessionEndedOrSuspended()) { + if(authorMode && qe.getEvent() == QTIWorksAssessmentTestEvent.Event.restart) { + restartTest(ureq); + } else if(timeLimitBarrier(ureq) || sessionReseted(ureq) || sessionEndedOrSuspended()) { return; } @@ -891,6 +896,7 @@ public class AssessmentTestDisplayController extends BasicController implements } private void restartTest(UserRequest ureq) { + resourcesList.deregisterResourceable(entry, subIdent, getWindow()); if(!candidateSession.isAuthorMode()) return; fireEvent(ureq, new RestartEvent()); }