use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class AssessmentItemEditorController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (tabbedPane == source) {
Controller selectedCtrl = tabbedPane.getSelectedController();
if (selectedCtrl instanceof SyncAssessmentItem) {
((SyncAssessmentItem) selectedCtrl).sync(ureq, itemBuilder);
} else if (selectedCtrl == displayCtrl) {
if (testEntry != null) {
AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(getIdentity(), null, testEntry, null, testEntry);
displayCtrl = new AssessmentItemPreviewController(ureq, getWindowControl(), resolvedAssessmentItem, itemRef, testEntry, assessmentEntry, rootDirectory, itemFile);
} else {
displayCtrl = new AssessmentItemPreviewController(ureq, getWindowControl(), resolvedAssessmentItem, rootDirectory, itemFile);
}
listenTo(displayCtrl);
tabbedPane.replaceTab(displayTabPosition, displayCtrl);
} else if (selectedCtrl == solutionCtrl) {
solutionCtrl = new AssessmentItemPreviewSolutionController(ureq, getWindowControl(), resolvedAssessmentItem, rootDirectory, itemFile);
listenTo(displayCtrl);
tabbedPane.replaceTab(solutionTabPosition, solutionCtrl);
}
}
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class IQRunController method exposeUserTestDataToVC.
private void exposeUserTestDataToVC(UserRequest ureq) {
// config : show score info
Object enableScoreInfoObject = modConfig.get(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
if (enableScoreInfoObject != null) {
myContent.contextPut("enableScoreInfo", enableScoreInfoObject);
} else {
myContent.contextPut("enableScoreInfo", Boolean.TRUE);
}
// configuration data
myContent.contextPut("attemptsConfig", modConfig.get(IQEditController.CONFIG_KEY_ATTEMPTS));
// user data
Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
if (courseNode instanceof PersistentAssessableCourseNode) {
PersistentAssessableCourseNode acn = (PersistentAssessableCourseNode) courseNode;
AssessmentEntry assessmentEntry = acn.getUserAssessmentEntry(userCourseEnv);
if (assessmentEntry == null) {
myContent.contextPut("blockAfterSuccess", Boolean.FALSE);
myContent.contextPut("score", null);
myContent.contextPut("hasPassedValue", Boolean.FALSE);
myContent.contextPut("passed", Boolean.FALSE);
myContent.contextPut("comment", null);
myContent.contextPut("docs", null);
myContent.contextPut("attempts", 0);
} else {
// block if test passed (and config set to check it)
Boolean blockAfterSuccess = modConfig.getBooleanEntry(IQEditController.CONFIG_KEY_BLOCK_AFTER_SUCCESS);
Boolean blocked = Boolean.FALSE;
if (blockAfterSuccess != null && blockAfterSuccess.booleanValue()) {
Boolean passed = assessmentEntry.getPassed();
if (passed != null && passed.booleanValue()) {
blocked = Boolean.TRUE;
}
}
myContent.contextPut("blockAfterSuccess", blocked);
boolean resultsVisible = assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
myContent.contextPut("resultsVisible", resultsVisible);
myContent.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
myContent.contextPut("hasPassedValue", (assessmentEntry.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
myContent.contextPut("passed", assessmentEntry.getPassed());
if (resultsVisible) {
if (acn.hasCommentConfigured()) {
StringBuilder comment = Formatter.stripTabsAndReturns(assessmentEntry.getComment());
myContent.contextPut("comment", StringHelper.xssScan(comment));
myContent.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
}
if (acn.hasIndividualAsssessmentDocuments()) {
List<File> docs = acn.getIndividualAssessmentDocuments(userCourseEnv);
String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
myContent.contextPut("docsMapperUri", mapperUri);
myContent.contextPut("docs", docs);
myContent.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
}
}
myContent.contextPut("attempts", assessmentEntry.getAttempts() == null ? 0 : assessmentEntry.getAttempts());
}
}
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
myContent.contextPut("log", am.getUserNodeLog(courseNode, identity));
exposeResults(ureq);
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class QTI21AssessmentRunController method doDownloadSignature.
private void doDownloadSignature(UserRequest ureq) {
MediaResource resource = null;
if (courseNode instanceof IQTESTCourseNode) {
IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
AssessmentEntry assessmentEntry = testCourseNode.getUserAssessmentEntry(userCourseEnv);
AssessmentTestSession session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
File signature = qtiService.getAssessmentResultSignature(session);
if (signature.exists()) {
resource = new DownloadeableMediaResource(signature);
}
}
if (resource == null) {
resource = new NotFoundMediaResource();
}
ureq.getDispatchResult().setResultingMediaResource(resource);
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class BasicLTICourseNode method getUserScoreEvaluation.
@Override
public AssessmentEvaluation getUserScoreEvaluation(UserCourseEnvironment userCourseEnv) {
AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
Identity mySelf = userCourseEnv.getIdentityEnvironment().getIdentity();
AssessmentEntry entry = am.getAssessmentEntry(this, mySelf);
return getUserScoreEvaluation(entry);
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class OLATUpgrade_11_2_1 method processTaskCourseNode.
private boolean processTaskCourseNode(ICourse course, RepositoryEntry entry, TACourseNode courseNode) {
List<AssessmentEntry> assessmentEntries = getAssessmentEntries(entry, courseNode);
if (assessmentEntries.size() > 0) {
CourseEnvironment courseEnv = course.getCourseEnvironment();
CoursePropertyManager cpm = courseEnv.getCoursePropertyManager();
File dropbox = new File(FolderConfig.getCanonicalRoot(), DropboxController.getDropboxPathRelToFolderRoot(courseEnv, courseNode));
File returnBox = new File(FolderConfig.getCanonicalRoot(), ReturnboxController.getReturnboxPathRelToFolderRoot(courseEnv, courseNode));
for (AssessmentEntry assessmentEntry : assessmentEntries) {
Identity assessedIdentity = assessmentEntry.getIdentity();
boolean changed = false;
List<Property> properties = cpm.findCourseNodeProperties(courseNode, assessedIdentity, null, TaskController.PROP_ASSIGNED);
if (properties != null && properties.size() > 0) {
assessmentEntry.setAssessmentStatus(AssessmentEntryStatus.inProgress);
} else {
File identityDropbox = new File(dropbox, assessedIdentity.getName());
File identityReturnBox = new File(returnBox, assessedIdentity.getName());
if (hasBoxedFiles(identityDropbox, identityReturnBox)) {
assessmentEntry.setAssessmentStatus(AssessmentEntryStatus.inProgress);
}
}
if (changed) {
courseEnv.getAssessmentManager().updateAssessmentEntry(assessmentEntry);
}
}
dbInstance.commitAndCloseSession();
}
return true;
}
Aggregations