use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project OpenOLAT by OpenOLAT.
the class QTI21EditLayoutForm method getMaxTimeLimit.
/**
* @return The time limit of the assessment test in seconds or -1 if not configured
*/
private long getMaxTimeLimit() {
FileResourceManager frm = FileResourceManager.getInstance();
File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
long timeLimit = -1;
if (assessmentTest != null && assessmentTest.getTimeLimits() != null && assessmentTest.getTimeLimits().getMaximum() != null) {
timeLimit = assessmentTest.getTimeLimits().getMaximum().longValue();
}
return timeLimit;
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project OpenOLAT by OpenOLAT.
the class AssessmentTestHelper method needManualCorrection.
public static boolean needManualCorrection(ResolvedAssessmentTest resolvedAssessmentTest) {
AssessmentTest test = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
boolean needManualCorrection = false;
List<TestPart> parts = test.getChildAbstractParts();
for (TestPart part : parts) {
List<AssessmentSection> sections = part.getAssessmentSections();
for (AssessmentSection section : sections) {
if (needManualCorrection(section, resolvedAssessmentTest)) {
needManualCorrection = true;
break;
}
}
}
return needManualCorrection;
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project OpenOLAT by OpenOLAT.
the class QTI21EditForm method update.
protected void update(RepositoryEntry testEntry) {
Double minValue = null;
Double maxValue = null;
Double cutValue = null;
FileResourceManager frm = FileResourceManager.getInstance();
File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
if (assessmentTest != null) {
AssessmentTestBuilder testBuilder = new AssessmentTestBuilder(assessmentTest);
maxValue = testBuilder.getMaxScore();
cutValue = testBuilder.getCutValue();
if (maxValue != null && "OpenOLAT".equals(assessmentTest.getToolName())) {
minValue = 0d;
}
}
// Put values to module configuration
minScoreEl.setValue(minValue == null ? "" : AssessmentHelper.getRoundedScore(minValue));
minScoreEl.setVisible(minValue != null);
maxScoreEl.setValue(maxValue == null ? "" : AssessmentHelper.getRoundedScore(maxValue));
maxScoreEl.setVisible(maxValue != null);
cutValueEl.setValue(cutValue == null ? "" : AssessmentHelper.getRoundedScore(cutValue));
cutValueEl.setVisible(cutValue != null);
update();
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project OpenOLAT by OpenOLAT.
the class AssessmentTestDisplayController method getAssessmentTestMaxTimeLimit.
/**
* @return The maximum time limit in seconds.
*/
private Long getAssessmentTestMaxTimeLimit() {
int extra = extraTime == null ? 0 : extraTime.intValue();
long leadingTime = getLeadingTimeEndTestOption();
if (overrideOptions != null && overrideOptions.getAssessmentTestMaxTimeLimit() != null) {
long timeLimits = overrideOptions.getAssessmentTestMaxTimeLimit().longValue();
return timeLimits > 0 ? Math.min(leadingTime, timeLimits) + extra : null;
}
AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
if (assessmentTest.getTimeLimits() != null && assessmentTest.getTimeLimits().getMaximum() != null) {
long timeLimits = assessmentTest.getTimeLimits().getMaximum().longValue();
return Math.min(leadingTime, timeLimits) + extra;
}
return null;
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project OpenOLAT by OpenOLAT.
the class AssessmentResultController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("options", options);
if (assessedIdentity != null) {
layoutCont.contextPut("userDisplayName", userMgr.getUserDisplayName(assessedIdentity.getKey()));
} else {
layoutCont.contextPut("userDisplayName", Boolean.FALSE);
}
if (testSessionState == null || assessmentResult == null) {
// An author has deleted the test session before the user end it.
// It can happen with time limited tests.
Results results = new Results(false, "o_qtiassessment_icon", false);
layoutCont.contextPut("testResults", results);
layoutCont.contextPut("itemResults", new ArrayList<>());
layoutCont.contextPut("testSessionNotFound", Boolean.TRUE);
} else {
layoutCont.contextPut("title", Boolean.valueOf(withTitle));
layoutCont.contextPut("print", Boolean.valueOf(withPrint));
layoutCont.contextPut("printCommand", Boolean.FALSE);
layoutCont.contextPut("toggleSolution", Boolean.valueOf(toggleSolution));
if (withPrint) {
layoutCont.contextPut("winid", "w" + layoutCont.getFormItemComponent().getDispatchID());
layoutCont.getFormItemComponent().addListener(this);
}
if (assessedIdentityInfosCtrl != null) {
layoutCont.put("assessedIdentityInfos", assessedIdentityInfosCtrl.getInitialComponent());
} else if (anonym) {
layoutCont.contextPut("anonym", Boolean.TRUE);
}
Results testResults = new Results(false, "o_qtiassessment_icon", options.isMetadata());
testResults.setSessionState(testSessionState);
layoutCont.contextPut("testResults", testResults);
TestResult testResult = assessmentResult.getTestResult();
if (testResult != null) {
extractOutcomeVariable(testResult.getItemVariables(), testResults);
if (candidateSession.getManualScore() != null) {
testResults.addScore(candidateSession.getManualScore());
testResults.setManualScore(candidateSession.getManualScore());
}
AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
Double cutValue = QtiNodesExtractor.extractCutValue(assessmentTest);
if (cutValue != null) {
testResults.setCutValue(cutValue);
}
}
if (signatureMapperUri != null) {
String signatureUrl = signatureMapperUri + "/assessmentResultSignature.xml";
layoutCont.contextPut("signatureUrl", signatureUrl);
}
// reset max score and aggregate
testResults.setMaxScore(null);
initFormSections(layoutCont, testResults);
}
}
}
Aggregations