use of org.olat.modules.assessment.model.AssessmentEntryStatus in project openolat by klemens.
the class PortfolioServiceImpl method getAssessmentStatus.
@Override
public AssessmentEntryStatus getAssessmentStatus(Identity assessedIdentity, BinderRef binderRef) {
Binder binder = binderDao.loadByKey(binderRef.getKey());
RepositoryEntry entry = binder.getEntry();
AssessmentEntryStatus status = null;
if ("CourseModule".equals(entry.getOlatResource().getResourceableTypeName())) {
ICourse course = CourseFactory.loadCourse(entry);
CourseNode courseNode = course.getRunStructure().getNode(binder.getSubIdent());
if (courseNode instanceof PortfolioCourseNode) {
PortfolioCourseNode pfNode = (PortfolioCourseNode) courseNode;
UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
AssessmentEvaluation eval = pfNode.getUserScoreEvaluation(userCourseEnv);
status = eval.getAssessmentStatus();
}
} else {
OLATResource resource = ((BinderImpl) binder.getTemplate()).getOlatResource();
RepositoryEntry referenceEntry = repositoryService.loadByResourceKey(resource.getKey());
AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, binder.getEntry(), binder.getSubIdent(), referenceEntry);
status = assessmentEntry.getAssessmentStatus();
}
return status;
}
use of org.olat.modules.assessment.model.AssessmentEntryStatus in project openolat by klemens.
the class OLATUpgrade_11_0_0 method processAssessmentPropertyForTA.
/**
* Search first for the status of the task, if not found, see if some documents
* where dropped or returned, in this case, the status is in review, if not
* the status is not started.
*
* @param assessedIdentity
* @param entry
* @param tNode
* @param course
*/
private void processAssessmentPropertyForTA(Identity assessedIdentity, AssessmentEntryImpl entry, TACourseNode tNode, ICourse course) {
List<Property> samples = course.getCourseEnvironment().getCoursePropertyManager().findCourseNodeProperties(tNode, assessedIdentity, null, TaskController.PROP_ASSIGNED);
if (samples.size() > 0) {
String details = samples.get(0).getStringValue();
entry.setDetails(details);
}
Property statusProperty = course.getCourseEnvironment().getCoursePropertyManager().findCourseNodeProperty(tNode, assessedIdentity, null, StatusManager.PROPERTY_KEY_STATUS);
AssessmentEntryStatus assessmentStatus = null;
if (statusProperty != null) {
String status = statusProperty.getStringValue();
if (status != null) {
switch(status) {
case StatusForm.STATUS_VALUE_NOT_OK:
assessmentStatus = AssessmentEntryStatus.inProgress;
break;
case StatusForm.STATUS_VALUE_OK:
assessmentStatus = AssessmentEntryStatus.done;
break;
case StatusForm.STATUS_VALUE_WORKING_ON:
assessmentStatus = AssessmentEntryStatus.inProgress;
break;
case StatusForm.STATUS_VALUE_UNDEFINED:
assessmentStatus = AssessmentEntryStatus.inProgress;
break;
}
}
}
if (assessmentStatus == null) {
String dropbox = DropboxController.getDropboxPathRelToFolderRoot(course.getCourseEnvironment(), tNode) + File.separator + assessedIdentity.getName();
OlatRootFolderImpl dropBox = new OlatRootFolderImpl(dropbox, null);
boolean hasDropped = (dropBox.getBasefile().exists() && dropBox.getBasefile().listFiles(SystemFileFilter.FILES_ONLY).length > 0);
String returnbox = ReturnboxController.getReturnboxPathRelToFolderRoot(course.getCourseEnvironment(), tNode) + File.separator + assessedIdentity.getName();
OlatRootFolderImpl returnBox = new OlatRootFolderImpl(returnbox, null);
boolean hasReturned = (returnBox.getBasefile().exists() && returnBox.getBasefile().listFiles(SystemFileFilter.FILES_ONLY).length > 0);
if (hasReturned || hasDropped) {
assessmentStatus = AssessmentEntryStatus.inReview;
} else {
assessmentStatus = AssessmentEntryStatus.notStarted;
}
}
entry.setAssessmentStatus(assessmentStatus);
}
use of org.olat.modules.assessment.model.AssessmentEntryStatus 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.modules.assessment.model.AssessmentEntryStatus in project openolat by klemens.
the class IQRunController method submitAssessment.
@Override
public void submitAssessment(AssessmentInstance ai) {
if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
AssessmentContext ac = ai.getAssessmentContext();
AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
Boolean fullyAssed = am.getNodeFullyAssessed(courseNode, getIdentity());
String correctionMode = courseNode.getModuleConfiguration().getStringValue(IQEditController.CONFIG_CORRECTION_MODE);
Boolean userVisibility;
AssessmentEntryStatus assessmentStatus;
if (IQEditController.CORRECTION_MANUAL.equals(correctionMode)) {
assessmentStatus = AssessmentEntryStatus.inReview;
userVisibility = Boolean.FALSE;
} else {
assessmentStatus = AssessmentEntryStatus.done;
userVisibility = Boolean.TRUE;
}
ScoreEvaluation sceval = new ScoreEvaluation(ac.getScore(), ac.isPassed(), assessmentStatus, userVisibility, fullyAssed, null, null, ai.getAssessID());
// assessment nodes are assessable
AssessableCourseNode acn = (AssessableCourseNode) courseNode;
acn.updateUserScoreEvaluation(sceval, userCourseEnv, getIdentity(), true, Role.user);
// Mark publisher for notifications
Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
assessmentNotificationsHandler.markPublisherNews(getIdentity(), courseId);
if (!assessmentStopped) {
assessmentStopped = true;
AssessmentEvent assessmentStoppedEvent = new AssessmentEvent(AssessmentEvent.TYPE.STOPPED, userSession);
singleUserEventCenter.deregisterFor(this, assessmentInstanceOres);
singleUserEventCenter.fireEventToListenersOf(assessmentStoppedEvent, assessmentEventOres);
}
} else if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SURVEY)) {
// save number of attempts
// although this is not an assessable node we still use the assessment
// manager since this one uses caching
AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
am.incrementNodeAttempts(courseNode, getIdentity(), userCourseEnv, Role.user);
} else if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SELF)) {
AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
am.incrementNodeAttempts(courseNode, getIdentity(), userCourseEnv, Role.user);
}
}
use of org.olat.modules.assessment.model.AssessmentEntryStatus 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