use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class IQConfigurationController method doConfirmChangeTestAndSurvey.
/**
* This check if there is some QTI 2.1 results for the current selected test.
*
* @param ureq
* @param newEntry
*/
private void doConfirmChangeTestAndSurvey(UserRequest ureq, RepositoryEntry newEntry) {
try {
RepositoryEntry currentEntry = courseNode.getReferencedRepositoryEntry();
RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
int numOfAssessedIdentities = 0;
if (currentEntry != null) {
List<AssessmentTestSession> assessmentTestSessions = qti21service.getAssessmentTestSessions(courseEntry, courseNode.getIdent(), currentEntry);
Set<Identity> assessedIdentities = new HashSet<>();
for (AssessmentTestSession assessmentTestSession : assessmentTestSessions) {
if (StringHelper.containsNonWhitespace(assessmentTestSession.getAnonymousIdentifier())) {
numOfAssessedIdentities++;
} else if (assessmentTestSession.getIdentity() != null) {
assessedIdentities.add(assessmentTestSession.getIdentity());
}
}
numOfAssessedIdentities += assessedIdentities.size();
}
if (numOfAssessedIdentities > 0) {
confirmChangeResourceCtrl = new ConfirmChangeResourceController(ureq, getWindowControl(), course, (QTICourseNode) courseNode, newEntry, currentEntry, numOfAssessedIdentities);
listenTo(confirmChangeResourceCtrl);
cmc = new CloseableModalController(getWindowControl(), translate("close"), confirmChangeResourceCtrl.getInitialComponent());
listenTo(cmc);
cmc.activate();
} else {
doChangeResource(ureq, newEntry);
}
} catch (Exception e) {
logError("", e);
showError("error.resource.corrupted");
}
}
use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class IQConfigurationController method cleanUpQti21PreviewSession.
/**
* Delete the test session created by the preview controller
* for the QTI 2.1 tests.
*/
private void cleanUpQti21PreviewSession() {
if (previewQTI21Ctrl != null) {
AssessmentTestSession previewSession = previewQTI21Ctrl.getCandidateSession();
qti21service.deleteAssessmentTestSession(previewSession);
}
}
use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class IQIdentityListCourseNodeController method doUpdateCourseNode.
private void doUpdateCourseNode(List<AssessmentTestSession> testSessionsToComplete, AssessmentTest assessmentTest, AssessmentEntryStatus status) {
if (testSessionsToComplete == null || testSessionsToComplete.isEmpty())
return;
Double cutValue = QtiNodesExtractor.extractCutValue(assessmentTest);
for (AssessmentTestSession testSession : testSessionsToComplete) {
UserCourseEnvironment assessedUserCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(testSession.getIdentity(), getCourseEnvironment());
ScoreEvaluation scoreEval = ((IQTESTCourseNode) courseNode).getUserScoreEvaluation(assessedUserCourseEnv);
BigDecimal finalScore = testSession.getFinalScore();
Float score = finalScore == null ? null : finalScore.floatValue();
Boolean passed = scoreEval.getPassed();
if (testSession.getManualScore() != null && finalScore != null && cutValue != null) {
boolean calculated = finalScore.compareTo(BigDecimal.valueOf(cutValue.doubleValue())) >= 0;
passed = Boolean.valueOf(calculated);
}
AssessmentEntryStatus finalStatus = status == null ? scoreEval.getAssessmentStatus() : status;
ScoreEvaluation manualScoreEval = new ScoreEvaluation(score, passed, finalStatus, scoreEval.getUserVisible(), scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), testSession.getKey());
((IQTESTCourseNode) courseNode).updateUserScoreEvaluation(manualScoreEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
}
}
use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class QTI21IdentityListCourseNodeToolsController method doOpenCorrection.
private void doOpenCorrection(UserRequest ureq) {
File unzippedDirRoot = FileResourceManager.getInstance().unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
ManifestBuilder manifestBuilder = ManifestBuilder.read(new File(unzippedDirRoot, "imsmanifest.xml"));
TestSessionState testSessionState = qtiService.loadTestSessionState(lastSession);
Map<Identity, AssessmentTestSession> lastSessionMap = new HashMap<>();
lastSessionMap.put(assessedIdentity, lastSession);
CorrectionOverviewModel model = new CorrectionOverviewModel(courseEntry, testCourseNode.getIdent(), testEntry, resolvedAssessmentTest, manifestBuilder, lastSessionMap, Collections.singletonMap(assessedIdentity, testSessionState));
correctionCtrl = new CorrectionIdentityAssessmentItemListController(ureq, getWindowControl(), stackPanel, model, lastSession, assessedIdentity);
listenTo(correctionCtrl);
stackPanel.pushController(translate("tool.correction"), correctionCtrl);
}
use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class QTI21IdentityListCourseNodeToolsController method doConfirmPullSession.
private void doConfirmPullSession(UserRequest ureq, AssessmentTestSession session) {
retrieveConfirmationCtr = new QTI21RetrieveTestsController(ureq, getWindowControl(), session, (IQTESTCourseNode) courseNode);
listenTo(retrieveConfirmationCtr);
String title = translate("tool.pull");
cmc = new CloseableModalController(getWindowControl(), null, retrieveConfirmationCtr.getInitialComponent(), true, title, true);
listenTo(cmc);
cmc.activate();
}
Aggregations