use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project OpenOLAT by OpenOLAT.
the class AssessmentTestDisplayController method initNumbering.
private void initNumbering() {
AtomicInteger number = new AtomicInteger(0);
List<TestPlanNode> nodes = testSessionController.getTestSessionState().getTestPlan().getTestPlanNodeList();
for (TestPlanNode node : nodes) {
if (node.getTestNodeType() == TestNodeType.ASSESSMENT_ITEM_REF) {
numbering.put(node, number.incrementAndGet());
} else if (node.getTestNodeType() == TestNodeType.TEST_PART) {
number.set(0);
}
}
}
use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project OpenOLAT by OpenOLAT.
the class AssessmentTestDisplayController method processFinishLinearItem.
// public CandidateSession finishLinearItem(final CandidateSessionContext candidateSessionContext)
// throws CandidateException {
private void processFinishLinearItem(UserRequest ureq) {
NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
TestSessionState testSessionState = testSessionController.getTestSessionState();
try {
if (!testSessionController.mayAdvanceItemLinear()) {
candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_FINISH_LINEAR_TEST_ITEM, null);
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);
// handleExplosion(e, candidateSession);
return;
}
// Update state
final Date requestTimestamp = ureq.getRequestTimestamp();
final TestPlanNode nextItemNode = testSessionController.advanceItemLinear(requestTimestamp);
// boolean terminated = nextItemNode == null && testSessionController.findNextEnterableTestPart() == null;
// Record current result state
final AssessmentResult assessmentResult = computeAndRecordTestAssessmentResult(requestTimestamp, testSessionState, false);
/* If we ended the testPart and there are now no more available testParts, then finish the session now */
if (nextItemNode == null && testSessionController.findNextEnterableTestPart() == null) {
candidateSession = qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult, requestTimestamp, getDigitalSignatureOptions(), getIdentity());
}
// Record and log event
final CandidateTestEventType eventType = nextItemNode != null ? CandidateTestEventType.FINISH_ITEM : CandidateTestEventType.FINISH_FINAL_ITEM;
final CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, eventType, null, null, testSessionState, notificationRecorder);
this.lastEvent = candidateTestEvent;
candidateAuditLogger.logCandidateEvent(candidateTestEvent);
}
use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project OpenOLAT by OpenOLAT.
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());
}
}
use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project OpenOLAT by OpenOLAT.
the class CorrectionIdentityAssessmentItemListController method loadModel.
private void loadModel(boolean reset) {
ResolvedAssessmentTest resolvedAssessmentTest = model.getResolvedAssessmentTest();
Map<Identifier, AssessmentItemRef> identifierToRefs = new HashMap<>();
for (AssessmentItemRef itemRef : resolvedAssessmentTest.getAssessmentItemRefs()) {
identifierToRefs.put(itemRef.getIdentifier(), itemRef);
}
List<AssessmentItemSession> allItemSessions = qtiService.getAssessmentItemSessions(candidateSession);
Map<String, AssessmentItemSession> identifierToItemSessions = new HashMap<>();
for (AssessmentItemSession itemSession : allItemSessions) {
identifierToItemSessions.put(itemSession.getAssessmentItemIdentifier(), itemSession);
}
// reorder to match the list of assessment items
List<CorrectionIdentityAssessmentItemRow> rows = new ArrayList<>();
TestSessionState testSessionState = model.getTestSessionStates().get(assessedIdentity);
List<TestPlanNode> nodes = testSessionState.getTestPlan().getTestPlanNodeList();
for (TestPlanNode node : nodes) {
if (node.getTestNodeType() == TestNodeType.ASSESSMENT_ITEM_REF) {
TestPlanNodeKey key = node.getKey();
AssessmentItemRef itemRef = identifierToRefs.get(key.getIdentifier());
AssessmentItemSession itemSession = identifierToItemSessions.get(key.getIdentifier().toString());
ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
ManifestMetadataBuilder metadata = model.getMetadata(itemRef);
AssessmentItem item = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
ItemSessionState itemSessionState = testSessionState.getItemSessionStates().get(key);
boolean manualCorrection = model.isManualCorrection(itemRef);
CorrectionIdentityAssessmentItemRow row = new CorrectionIdentityAssessmentItemRow(assessedIdentity, item, itemRef, metadata, candidateSession, itemSession, itemSessionState, manualCorrection);
row.setTitle(title);
row.setTitleCssClass("o_icon_user");
rows.add(row);
}
}
tableModel.setObjects(rows);
tableEl.reset(reset, reset, true);
}
use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project openolat by klemens.
the class QTI21ServiceImpl method reopenTestPart.
private TestPlanNodeKey reopenTestPart(TestPlanNode lastItem, TestSessionState testSessionState) {
TestPlan plan = testSessionState.getTestPlan();
List<TestPlanNode> testPartNodes = lastItem.searchAncestors(TestNodeType.TEST_PART);
if (testPartNodes.isEmpty()) {
return null;
}
// reopen the test part of the selected item
TestPlanNode partNode = testPartNodes.get(0);
TestPlanNodeKey partKey = partNode.getKey();
TestPartSessionState partState = testSessionState.getTestPartSessionStates().get(partKey);
partState.setEndTime(null);
partState.setExitTime(null);
// reopen all sections the test part
for (Map.Entry<TestPlanNodeKey, AssessmentSectionSessionState> sectionEntry : testSessionState.getAssessmentSectionSessionStates().entrySet()) {
TestPlanNodeKey sectionKey = sectionEntry.getKey();
TestPlanNode sectionNode = plan.getNode(sectionKey);
if (sectionNode.hasAncestor(partNode)) {
AssessmentSectionSessionState sectionState = sectionEntry.getValue();
sectionState.setEndTime(null);
sectionState.setExitTime(null);
}
}
// reopen all items the test part
for (Map.Entry<TestPlanNodeKey, ItemSessionState> itemEntry : testSessionState.getItemSessionStates().entrySet()) {
TestPlanNodeKey itemKey = itemEntry.getKey();
TestPlanNode itemNode = plan.getNode(itemKey);
if (itemNode.hasAncestor(partNode)) {
ItemSessionState itemState = itemEntry.getValue();
itemState.setEndTime(null);
itemState.setExitTime(null);
}
}
return partKey;
}
Aggregations