use of uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey in project openolat by klemens.
the class AssessmentTestDisplayController method processItemSolution.
private void processItemSolution(UserRequest ureq, String key) {
TestPlanNodeKey itemKey = TestPlanNodeKey.fromString(key);
NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
TestSessionState testSessionState = testSessionController.getTestSessionState();
// assertSessionNotTerminated(candidateSession);
try {
if (!testSessionController.mayAccessItemSolution(itemKey)) {
candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_SOLUTION_TEST_ITEM, null);
logError("CANNOT_SOLUTION_TEST_ITEM", null);
return;
}
} catch (final QtiCandidateStateException e) {
candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_SOLUTION_TEST_ITEM, e);
logError("CANNOT_SOLUTION_TEST_ITEM", e);
return;
} catch (final RuntimeException e) {
candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_SOLUTION_TEST_ITEM, e);
logError("Exploded", e);
// handleExplosion(e, candidateSession);
return;
}
/* Record current result state */
computeAndRecordTestAssessmentResult(ureq.getRequestTimestamp(), testSessionState, false);
/* Record and log event */
CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, CandidateTestEventType.SOLUTION_ITEM, null, itemKey, testSessionState, notificationRecorder);
this.lastEvent = candidateTestEvent;
candidateAuditLogger.logCandidateEvent(candidateTestEvent);
}
use of uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey in project openolat by klemens.
the class QTI21AssessmentDetailsController method updateModel.
protected void updateModel() {
List<AssessmentTestSessionStatistics> sessionsStatistics = qtiService.getAssessmentTestSessionsStatistics(entry, subIdent, assessedIdentity);
List<QTI21AssessmentTestSessionDetails> infos = new ArrayList<>();
for (AssessmentTestSessionStatistics sessionStatistics : sessionsStatistics) {
AssessmentTestSession testSession = sessionStatistics.getTestSession();
TestSessionState testSessionState = qtiService.loadTestSessionState(testSession);
TestPlan testPlan = testSessionState.getTestPlan();
List<TestPlanNode> nodes = testPlan.getTestPlanNodeList();
int responded = 0;
int numOfItems = 0;
for (TestPlanNode node : nodes) {
TestNodeType testNodeType = node.getTestNodeType();
ItemSessionState itemSessionState = testSessionState.getItemSessionStates().get(node.getKey());
TestPlanNodeKey testPlanNodeKey = node.getKey();
if (testPlanNodeKey != null && testPlanNodeKey.getIdentifier() != null && testNodeType == TestNodeType.ASSESSMENT_ITEM_REF) {
numOfItems++;
if (itemSessionState.isResponded()) {
responded++;
}
}
}
infos.add(new QTI21AssessmentTestSessionDetails(testSession, numOfItems, responded, sessionStatistics.getNumOfCorrectedItems()));
}
Collections.sort(infos, new AssessmentTestSessionDetailsComparator());
tableModel.setObjects(infos);
tableEl.reloadData();
tableEl.reset();
if (resetButton != null) {
resetButton.setVisible(!sessionsStatistics.isEmpty());
}
}
Aggregations