use of org.olat.ims.qti.QTIResultSet in project openolat by klemens.
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.qti.QTIResultSet in project openolat by klemens.
the class QTI12ResultsExportMediaResource method createResultDetail.
private List<ResultDetail> createResultDetail(Identity identity, ZipOutputStream zout, String idDir) throws IOException {
Long resourceId = courseEnv.getCourseResourceableId();
String resourceDetail = courseNode.getIdent();
Long resid = courseNode.getReferencedRepositoryEntry().getKey();
List<QTIResultSet> resultSets = qtiResultManager.getResultSets(resourceId, resourceDetail, resid, identity);
List<ResultDetail> assessments = new ArrayList<ResultDetail>();
for (QTIResultSet qtiResultSet : resultSets) {
Long assessmentID = qtiResultSet.getAssessmentID();
String idPath = idDir + translator.translate("table.user.attempt") + (resultSets.indexOf(qtiResultSet) + 1) + SEP;
createZipDirectory(zout, idPath);
String linkToHTML = createHTMLfromQTIResultSet(idPath, idDir, zout, identity, qtiResultSet);
// content of result table
ResultDetail resultDetail = new ResultDetail(createLink(String.valueOf(assessmentID), linkToHTML, true), assessmentDateFormat.format(qtiResultSet.getCreationDate()), displayDateFormat.format(new Date(qtiResultSet.getDuration())), qtiResultSet.getScore(), createPassedIcons(qtiResultSet.getIsPassed()), linkToHTML);
assessments.add(resultDetail);
}
return assessments;
}
Aggregations