use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project openolat by klemens.
the class IQTESTCourseNode method getQTI21TimeLimitMaxInSeconds.
/**
* If the course element override the test configuration, the value is from
* the course element's configuration. Else, the value is from the assessment
* test.
*
* @param testEntry The test repository entry
* @return the maximum time limit in seconds or -1 if no time limit is configured
*/
public int getQTI21TimeLimitMaxInSeconds(RepositoryEntry testEntry) {
int timeLimit = -1;
if (ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) {
ModuleConfiguration config = getModuleConfiguration();
boolean configRef = config.getBooleanSafe(IQEditController.CONFIG_KEY_CONFIG_REF, false);
if (!configRef && config.getIntegerSafe(IQEditController.CONFIG_KEY_TIME_LIMIT, -1) > 0) {
timeLimit = config.getIntegerSafe(IQEditController.CONFIG_KEY_TIME_LIMIT, -1);
} else {
File unzippedDirRoot = FileResourceManager.getInstance().unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = CoreSpringFactory.getImpl(QTI21Service.class).loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
if (assessmentTest.getTimeLimits() != null && assessmentTest.getTimeLimits().getMaximum() != null) {
timeLimit = assessmentTest.getTimeLimits().getMaximum().intValue();
}
}
}
return timeLimit;
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project openolat by klemens.
the class IQTESTCourseNode method hasQTI21TimeLimit.
/**
* @param testEntry The test repository entry
* @return true if the course node or the test has a time limit set.
*/
public boolean hasQTI21TimeLimit(RepositoryEntry testEntry) {
boolean timeLimit = false;
if (ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) {
ModuleConfiguration config = getModuleConfiguration();
boolean configRef = config.getBooleanSafe(IQEditController.CONFIG_KEY_CONFIG_REF, false);
if (!configRef && config.getIntegerSafe(IQEditController.CONFIG_KEY_TIME_LIMIT, -1) > 0) {
timeLimit = true;
} else {
File unzippedDirRoot = FileResourceManager.getInstance().unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = CoreSpringFactory.getImpl(QTI21Service.class).loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
if (assessmentTest.getTimeLimits() != null && assessmentTest.getTimeLimits().getMaximum() != null) {
timeLimit = true;
}
}
}
return timeLimit;
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project openolat by klemens.
the class CorrectionAssessmentItemListController method doSaveTests.
private void doSaveTests(UserRequest ureq) {
List<AssessmentTestSession> rows = new ArrayList<>(model.getLastSessions().values());
AssessmentTest assessmentTest = model.getResolvedAssessmentTest().getRootNodeLookup().extractIfSuccessful();
fireEvent(ureq, new CompleteAssessmentTestSessionEvent(rows, assessmentTest, AssessmentEntryStatus.done));
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project openolat by klemens.
the class CorrectionIdentityAssessmentItemListController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
if ("select".equals(cmd)) {
CorrectionIdentityAssessmentItemRow row = tableModel.getObject(se.getIndex());
doSelect(ureq, row);
}
}
} else if (saveButton == source) {
List<AssessmentTestSession> sessions = Collections.singletonList(candidateSession);
AssessmentTest assessmentTest = model.getResolvedAssessmentTest().getRootNodeLookup().extractIfSuccessful();
fireEvent(ureq, new CompleteAssessmentTestSessionEvent(sessions, assessmentTest, AssessmentEntryStatus.done));
}
super.formInnerEvent(ureq, source, event);
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest in project openolat by klemens.
the class CorrectionIdentityListController method doSaveTests.
private void doSaveTests(UserRequest ureq) {
Set<Integer> selections = tableEl.getMultiSelectedIndex();
List<AssessmentTestSession> rows = new ArrayList<>(selections.size());
for (Integer i : selections) {
CorrectionIdentityRow row = tableModel.getObject(i.intValue());
if (row != null) {
rows.add(row.getCandidateSession());
}
}
AssessmentTest assessmentTest = model.getResolvedAssessmentTest().getRootNodeLookup().extractIfSuccessful();
fireEvent(ureq, new CompleteAssessmentTestSessionEvent(rows, assessmentTest, AssessmentEntryStatus.done));
}
Aggregations