use of org.olat.course.nodes.IQTESTCourseNode in project openolat by klemens.
the class IQIdentityListCourseNodeController method doConfirmPull.
private void doConfirmPull(UserRequest ureq) {
AssessmentToolOptions asOptions = getOptions();
RepositoryEntry testEntry = getReferencedRepositoryEntry();
CourseEnvironment courseEnv = getCourseEnvironment();
if (ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) {
retrieveConfirmationCtr = new QTI21RetrieveTestsController(ureq, getWindowControl(), courseEnv, asOptions, (IQTESTCourseNode) courseNode);
} else {
retrieveConfirmationCtr = new QTI12PullTestsToolController(ureq, getWindowControl(), courseEnv, asOptions, (IQTESTCourseNode) courseNode);
}
listenTo(retrieveConfirmationCtr);
String title = translate("tool.pull");
cmc = new CloseableModalController(getWindowControl(), null, retrieveConfirmationCtr.getInitialComponent(), true, title, true);
listenTo(cmc);
cmc.activate();
}
use of org.olat.course.nodes.IQTESTCourseNode in project openolat by klemens.
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.course.nodes.IQTESTCourseNode in project openolat by klemens.
the class QTI21AssessmentRunController method doCancelAssessment.
private void doCancelAssessment(UserRequest ureq) {
if (displayContainerController != null) {
displayContainerController.deactivate(ureq);
} else {
getWindowControl().pop();
}
removeHistory(ureq);
if (courseNode instanceof IQTESTCourseNode) {
((IQTESTCourseNode) courseNode).updateCurrentCompletion(userCourseEnv, getIdentity(), null, null, Role.user);
}
OLATResourceable ores = OresHelper.createOLATResourceableInstance("test", -1l);
addToHistory(ureq, ores, null);
}
use of org.olat.course.nodes.IQTESTCourseNode in project openolat by klemens.
the class QTI21AssessmentRunController method initAssessment.
private void initAssessment(UserRequest ureq) {
// config : show score info
boolean enableScoreInfo = config.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
mainVC.contextPut("enableScoreInfo", Boolean.valueOf(enableScoreInfo));
// configuration data
int maxAttempts = deliveryOptions.getMaxAttempts();
if (maxAttempts > 0) {
mainVC.contextPut("attemptsConfig", Integer.valueOf(maxAttempts));
} else {
mainVC.contextPut("attemptsConfig", Boolean.FALSE);
}
// configure date period
mainVC.contextPut("blockDate", Boolean.valueOf(blockedBasedOnDate()));
// time limit
Long timeLimit = getAssessmentTestMaxTimeLimit();
if (timeLimit != null) {
mainVC.contextPut("timeLimit", Formatter.formatHourAndSeconds(timeLimit.longValue() * 1000l));
}
if (courseNode instanceof AssessableCourseNode) {
AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
if (assessableCourseNode.hasScoreConfigured() || userCourseEnv.isCoach()) {
HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), userCourseEnv, courseNode);
if (highScoreCtr.isViewHighscore()) {
Component highScoreComponent = highScoreCtr.getInitialComponent();
mainVC.put("highScore", highScoreComponent);
}
}
}
// user data
if (courseNode instanceof SelfAssessableCourseNode) {
SelfAssessableCourseNode acn = (SelfAssessableCourseNode) courseNode;
ScoreEvaluation scoreEval = acn.getUserScoreEvaluation(userCourseEnv);
Integer attempts = acn.getUserAttempts(userCourseEnv);
if (scoreEval != null) {
mainVC.contextPut("resultsVisible", Boolean.TRUE);
mainVC.contextPut("hasResults", Boolean.TRUE);
mainVC.contextPut("score", AssessmentHelper.getRoundedScore(scoreEval.getScore()));
mainVC.contextPut("hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
mainVC.contextPut("passed", scoreEval.getPassed());
// at least one attempt
mainVC.contextPut("attempts", attempts);
mainVC.contextPut("showChangeLog", Boolean.TRUE && enableScoreInfo);
exposeResults(ureq, true);
} else {
exposeResults(ureq, false);
}
} else if (courseNode instanceof IQTESTCourseNode) {
IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
AssessmentEntry assessmentEntry = testCourseNode.getUserAssessmentEntry(userCourseEnv);
if (assessmentEntry == null) {
mainVC.contextPut("blockAfterSuccess", Boolean.FALSE);
mainVC.contextPut("score", null);
mainVC.contextPut("hasPassedValue", Boolean.FALSE);
mainVC.contextPut("passed", Boolean.FALSE);
mainVC.contextPut("comment", null);
mainVC.contextPut("attempts", 0);
mainVC.contextPut("showChangeLog", Boolean.FALSE);
} else {
Boolean passed = assessmentEntry.getPassed();
// block if test passed (and config set to check it)
Boolean blocked = Boolean.FALSE;
boolean blockAfterSuccess = deliveryOptions.isBlockAfterSuccess();
if (blockAfterSuccess && passed != null && passed.booleanValue()) {
blocked = Boolean.TRUE;
}
mainVC.contextPut("blockAfterSuccess", blocked);
boolean resultsVisible = assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
mainVC.contextPut("resultsVisible", resultsVisible);
mainVC.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
mainVC.contextPut("hasPassedValue", (passed == null ? Boolean.FALSE : Boolean.TRUE));
mainVC.contextPut("passed", passed);
if (resultsVisible) {
if (testCourseNode.hasCommentConfigured()) {
StringBuilder comment = Formatter.stripTabsAndReturns(testCourseNode.getUserUserComment(userCourseEnv));
if (comment != null && comment.length() > 0) {
mainVC.contextPut("comment", StringHelper.xssScan(comment));
mainVC.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
}
}
if (testCourseNode.hasIndividualAsssessmentDocuments()) {
List<File> docs = testCourseNode.getIndividualAssessmentDocuments(userCourseEnv);
String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
mainVC.contextPut("docsMapperUri", mapperUri);
mainVC.contextPut("docs", docs);
mainVC.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
}
}
Integer attempts = assessmentEntry.getAttempts();
mainVC.contextPut("attempts", attempts == null ? new Integer(0) : attempts);
boolean showChangelog = (!anonym && enableScoreInfo && resultsVisible && isResultVisible(config));
mainVC.contextPut("showChangeLog", showChangelog);
if (deliveryOptions.isDigitalSignature()) {
AssessmentTestSession session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
if (session != null) {
File signature = qtiService.getAssessmentResultSignature(session);
if (signature != null && signature.exists()) {
signatureDownloadLink = LinkFactory.createLink("digital.signature.download.link", mainVC, this);
signatureDownloadLink.setIconLeftCSS("o_icon o_icon-fw o_icon_download");
signatureDownloadLink.setTarget("_blank");
Date issueDate = qtiService.getAssessmentResultSignatureIssueDate(session);
if (issueDate != null) {
mainVC.contextPut("signatureIssueDate", Formatter.getInstance(getLocale()).formatDateAndTime(issueDate));
}
}
}
}
exposeResults(ureq, resultsVisible);
}
}
}
use of org.olat.course.nodes.IQTESTCourseNode in project openolat by klemens.
the class QTI21AssessmentRunController method submit.
@Override
public void submit(Float score, Boolean pass, Double completion, Long assessmentId) {
if (anonym) {
assessmentNotificationsHandler.markPublisherNews(getIdentity(), userCourseEnv.getCourseEnvironment().getCourseResourceableId());
return;
}
if (courseNode instanceof IQTESTCourseNode) {
Boolean visibility;
AssessmentEntryStatus assessmentStatus;
if (IQEditController.CORRECTION_MANUAL.equals(courseNode.getModuleConfiguration().getStringValue(IQEditController.CONFIG_CORRECTION_MODE))) {
assessmentStatus = AssessmentEntryStatus.inReview;
visibility = Boolean.FALSE;
} else {
assessmentStatus = AssessmentEntryStatus.done;
visibility = Boolean.TRUE;
}
ScoreEvaluation sceval = new ScoreEvaluation(score, pass, assessmentStatus, visibility, Boolean.TRUE, completion, AssessmentRunStatus.done, assessmentId);
boolean increment = incrementAttempts.getAndSet(false);
((IQTESTCourseNode) courseNode).updateUserScoreEvaluation(sceval, userCourseEnv, getIdentity(), increment, Role.user);
if (increment) {
ThreadLocalUserActivityLogger.log(QTI21LoggingAction.QTI_CLOSE_IN_COURSE, getClass());
}
coordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(new CompletionEvent(CompletionEvent.PROGRESS, courseNode.getIdent(), completion, AssessmentRunStatus.done, getIdentity().getKey()), userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseResource());
assessmentNotificationsHandler.markPublisherNews(getIdentity(), userCourseEnv.getCourseEnvironment().getCourseResourceableId());
} else if (courseNode instanceof SelfAssessableCourseNode) {
boolean increment = incrementAttempts.getAndSet(false);
if (increment) {
((SelfAssessableCourseNode) courseNode).incrementUserAttempts(userCourseEnv, Role.user);
}
}
}
Aggregations