use of org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder.ScoreEvaluation in project OpenOLAT by OpenOLAT.
the class IQSELFCourseNode method getUserScoreEvaluation.
/**
* @see org.olat.course.nodes.SelfAssessableCourseNode#getUserScoreEvaluation(org.olat.course.run.userview.UserCourseEnvironment)
*/
@Override
public ScoreEvaluation getUserScoreEvaluation(final UserCourseEnvironment userCourseEnv) {
// read score from properties save score, passed and attempts information
ScoreEvaluation scoreEvaluation = null;
RepositoryEntry referencedRepositoryEntry = getReferencedRepositoryEntry();
if (referencedRepositoryEntry != null && OnyxModule.isOnyxTest(getReferencedRepositoryEntry().getOlatResource())) {
AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
Identity mySelf = userCourseEnv.getIdentityEnvironment().getIdentity();
Boolean passed = am.getNodePassed(this, mySelf);
Float score = am.getNodeScore(this, mySelf);
Long assessmentID = am.getAssessmentID(this, mySelf);
// <OLATCE-374>
Boolean fullyAssessed = am.getNodeFullyAssessed(this, mySelf);
scoreEvaluation = new ScoreEvaluation(score, passed, fullyAssessed, assessmentID);
// </OLATCE-374>
} else if (referencedRepositoryEntry != null && ImsQTI21Resource.TYPE_NAME.equals(referencedRepositoryEntry.getOlatResource().getResourceableTypeName())) {
RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
Identity assessedIdentity = userCourseEnv.getIdentityEnvironment().getIdentity();
AssessmentTestSession testSession = CoreSpringFactory.getImpl(QTI21Service.class).getLastAssessmentTestSessions(courseEntry, getIdent(), referencedRepositoryEntry, assessedIdentity);
if (testSession != null) {
boolean fullyAssessed = (testSession.getFinishTime() != null || testSession.getTerminationTime() != null);
Float score = testSession.getScore().floatValue();
return new ScoreEvaluation(score, testSession.getPassed(), fullyAssessed, testSession.getKey());
}
} else {
Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
long olatResourceId = userCourseEnv.getCourseEnvironment().getCourseResourceableId().longValue();
QTIResultSet qTIResultSet = CoreSpringFactory.getImpl(IQManager.class).getLastResultSet(identity, olatResourceId, this.getIdent());
if (qTIResultSet != null) {
Boolean passed = qTIResultSet.getIsPassed();
Boolean fullyAssessed = qTIResultSet.getFullyAssessed();
scoreEvaluation = new ScoreEvaluation(Float.valueOf(qTIResultSet.getScore()), passed, fullyAssessed, new Long(qTIResultSet.getAssessmentID()));
}
}
return scoreEvaluation;
}
use of org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder.ScoreEvaluation in project OpenOLAT by OpenOLAT.
the class FIBAssessmentItemBuilder method buildResponseAndOutcomeDeclarations.
@Override
protected void buildResponseAndOutcomeDeclarations() {
List<ResponseDeclaration> responseDeclarations = assessmentItem.getResponseDeclarations();
/*
<responseDeclaration identifier="RESPONSE_1" cardinality="single" baseType="string">
<correctResponse>
<value>
Gap
</value>
</correctResponse>
<mapping defaultValue="0">
<mapEntry mapKey="Gap" mappedValue="2" />
<mapEntry mapKey="gap1" mappedValue="2" />
<mapEntry mapKey="gap2" mappedValue="1" />
</mapping>
</responseDeclaration>
*/
for (Map.Entry<String, AbstractEntry> textEntryEntry : responseIdentifierToTextEntry.entrySet()) {
AbstractEntry entry = textEntryEntry.getValue();
if (entry instanceof TextEntry) {
TextEntry textEntry = (TextEntry) entry;
if (textEntry.getSolution() != null) {
Double score = -1.0d;
if (scoreEvaluation == ScoreEvaluation.perAnswer) {
score = textEntry.getScore();
}
ResponseDeclaration responseDeclaration = createTextEntryResponseDeclaration(assessmentItem, textEntry.getResponseIdentifier(), textEntry.getSolution(), score, textEntry.isCaseSensitive(), textEntry.getAlternatives());
responseDeclarations.add(responseDeclaration);
}
} else if (entry instanceof NumericalEntry) {
NumericalEntry textEntry = (NumericalEntry) entry;
if (textEntry.getSolution() != null) {
ResponseDeclaration responseDeclaration = createNumericalEntryResponseDeclaration(assessmentItem, textEntry.getResponseIdentifier(), textEntry.getSolution());
responseDeclarations.add(responseDeclaration);
}
}
}
}
use of org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder.ScoreEvaluation in project OpenOLAT by OpenOLAT.
the class HottextAssessmentItemBuilder method extractScoreEvaluationMode.
private void extractScoreEvaluationMode() {
boolean hasMapping = false;
if (hottextInteraction != null) {
ResponseDeclaration responseDeclaration = assessmentItem.getResponseDeclaration(hottextInteraction.getResponseIdentifier());
if (responseDeclaration != null) {
Mapping mapping = responseDeclaration.getMapping();
hasMapping = (mapping != null && mapping.getMapEntries() != null && mapping.getMapEntries().size() > 0);
if (hasMapping) {
scoreMapping = new HashMap<>();
for (MapEntry entry : mapping.getMapEntries()) {
SingleValue sValue = entry.getMapKey();
if (sValue instanceof IdentifierValue) {
Identifier identifier = ((IdentifierValue) sValue).identifierValue();
scoreMapping.put(identifier, entry.getMappedValue());
}
}
}
}
}
scoreEvaluation = hasMapping ? ScoreEvaluation.perAnswer : ScoreEvaluation.allCorrectAnswers;
}
use of org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder.ScoreEvaluation in project OpenOLAT by OpenOLAT.
the class MultipleChoiceAssessmentItemBuilder method buildResponseAndOutcomeDeclarations.
@Override
protected void buildResponseAndOutcomeDeclarations() {
ResponseDeclaration responseDeclaration = AssessmentItemFactory.createMultipleChoiceCorrectResponseDeclaration(assessmentItem, responseIdentifier, correctAnswers);
if (scoreEvaluation == ScoreEvaluation.perAnswer) {
AssessmentItemFactory.appendMapping(responseDeclaration, scoreMapping);
}
assessmentItem.getResponseDeclarations().add(responseDeclaration);
}
use of org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder.ScoreEvaluation in project OpenOLAT by OpenOLAT.
the class SingleChoiceAssessmentItemBuilder method buildResponseAndOutcomeDeclarations.
@Override
protected void buildResponseAndOutcomeDeclarations() {
ResponseDeclaration responseDeclaration = AssessmentItemFactory.createSingleChoiceCorrectResponseDeclaration(assessmentItem, responseIdentifier, correctAnswer);
if (scoreEvaluation == ScoreEvaluation.perAnswer) {
AssessmentItemFactory.appendMapping(responseDeclaration, scoreMapping);
}
assessmentItem.getResponseDeclarations().add(responseDeclaration);
}
Aggregations