Search in sources :

Example 6 with BasicLTICourseNode

use of org.olat.course.nodes.BasicLTICourseNode in project OpenOLAT by OpenOLAT.

the class CourseNodeOutcomeMapper method doUpdateResult.

@Override
protected boolean doUpdateResult(Float score) {
    ICourse course = CourseFactory.loadCourse(courseOresId);
    CourseNode node = course.getRunStructure().getNode(courseNodeId);
    if (node instanceof BasicLTICourseNode) {
        BasicLTICourseNode ltiNode = (BasicLTICourseNode) node;
        Identity assessedId = getIdentity();
        Float cutValue = getCutValue(ltiNode);
        Float scaledScore = null;
        Boolean passed = null;
        if (score != null) {
            float scale = getScalingFactor(ltiNode);
            scaledScore = score * scale;
            if (cutValue != null) {
                passed = scaledScore >= cutValue;
            }
        }
        ScoreEvaluation eval = new ScoreEvaluation(scaledScore, passed);
        UserCourseEnvironment userCourseEnv = getUserCourseEnvironment(course);
        ltiNode.updateUserScoreEvaluation(eval, userCourseEnv, assessedId, false, Role.user);
    }
    return super.doUpdateResult(score);
}
Also used : BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) Identity(org.olat.core.id.Identity)

Example 7 with BasicLTICourseNode

use of org.olat.course.nodes.BasicLTICourseNode in project OpenOLAT by OpenOLAT.

the class CourseNodeOutcomeMapper method doReadResult.

@Override
protected String doReadResult(IMSPOXRequest pox) {
    ICourse course = CourseFactory.loadCourse(courseOresId);
    CourseNode node = course.getRunStructure().getNode(courseNodeId);
    if (node instanceof BasicLTICourseNode) {
        BasicLTICourseNode ltiNode = (BasicLTICourseNode) node;
        UserCourseEnvironment userCourseEnv = getUserCourseEnvironment(course);
        ScoreEvaluation eval = ltiNode.getUserScoreEvaluation(userCourseEnv);
        String score = "";
        if (eval != null && eval.getScore() != null) {
            float scaledScore = eval.getScore();
            if (scaledScore > 0.0f) {
                float scale = getScalingFactor(ltiNode);
                scaledScore = scaledScore / scale;
            }
            score = Float.toString(scaledScore);
        }
        Map<String, Object> theMap = new TreeMap<String, Object>();
        theMap.put("/readResultResponse/result/sourcedId", getSourcedId());
        theMap.put("/readResultResponse/result/resultScore/textString", score);
        theMap.put("/readResultResponse/result/resultScore/language", "en");
        String theXml = XMLMap.getXMLFragment(theMap, true);
        return pox.getResponseSuccess("Result read", theXml);
    }
    return super.doReadResult(pox);
}
Also used : BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) TreeMap(java.util.TreeMap)

Example 8 with BasicLTICourseNode

use of org.olat.course.nodes.BasicLTICourseNode in project OpenOLAT by OpenOLAT.

the class CourseNodeOutcomeMapper method doDeleteResult.

@Override
protected boolean doDeleteResult() {
    ICourse course = CourseFactory.loadCourse(courseOresId);
    CourseNode node = course.getRunStructure().getNode(courseNodeId);
    if (node instanceof BasicLTICourseNode) {
        BasicLTICourseNode ltiNode = (BasicLTICourseNode) node;
        Identity assessedId = getIdentity();
        ScoreEvaluation eval = new ScoreEvaluation(0.0f, false);
        UserCourseEnvironment userCourseEnv = getUserCourseEnvironment(course);
        ltiNode.updateUserScoreEvaluation(eval, userCourseEnv, assessedId, false, Role.user);
    }
    return super.doDeleteResult();
}
Also used : BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) Identity(org.olat.core.id.Identity)

Example 9 with BasicLTICourseNode

use of org.olat.course.nodes.BasicLTICourseNode in project openolat by klemens.

the class OLATUpgrade_11_0_0 method postCopyPassedScore.

/**
 * Used if a passed or score value was set.
 * @param nodeAssessment
 * @param course
 */
private void postCopyPassedScore(AssessmentEntry entry, ICourse course) {
    String nodeIdent = entry.getSubIdent();
    CourseNode courseNode = course.getRunStructure().getNode(nodeIdent);
    if (courseNode instanceof GTACourseNode) {
    // 
    } else if (courseNode instanceof TACourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof IQTESTCourseNode) {
    // 
    } else if (courseNode instanceof PortfolioCourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof MSCourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof BasicLTICourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof ScormCourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    }
}
Also used : BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode)

Example 10 with BasicLTICourseNode

use of org.olat.course.nodes.BasicLTICourseNode in project openolat by klemens.

the class CourseNodeOutcomeMapper method doUpdateResult.

@Override
protected boolean doUpdateResult(Float score) {
    ICourse course = CourseFactory.loadCourse(courseOresId);
    CourseNode node = course.getRunStructure().getNode(courseNodeId);
    if (node instanceof BasicLTICourseNode) {
        BasicLTICourseNode ltiNode = (BasicLTICourseNode) node;
        Identity assessedId = getIdentity();
        Float cutValue = getCutValue(ltiNode);
        Float scaledScore = null;
        Boolean passed = null;
        if (score != null) {
            float scale = getScalingFactor(ltiNode);
            scaledScore = score * scale;
            if (cutValue != null) {
                passed = scaledScore >= cutValue;
            }
        }
        ScoreEvaluation eval = new ScoreEvaluation(scaledScore, passed);
        UserCourseEnvironment userCourseEnv = getUserCourseEnvironment(course);
        ltiNode.updateUserScoreEvaluation(eval, userCourseEnv, assessedId, false, Role.user);
    }
    return super.doUpdateResult(score);
}
Also used : BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) Identity(org.olat.core.id.Identity)

Aggregations

BasicLTICourseNode (org.olat.course.nodes.BasicLTICourseNode)10 CourseNode (org.olat.course.nodes.CourseNode)10 ICourse (org.olat.course.ICourse)6 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)6 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)6 Identity (org.olat.core.id.Identity)4 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)4 GTACourseNode (org.olat.course.nodes.GTACourseNode)4 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)4 MSCourseNode (org.olat.course.nodes.MSCourseNode)4 PortfolioCourseNode (org.olat.course.nodes.PortfolioCourseNode)4 STCourseNode (org.olat.course.nodes.STCourseNode)4 ScormCourseNode (org.olat.course.nodes.ScormCourseNode)4 TACourseNode (org.olat.course.nodes.TACourseNode)4 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 List (java.util.List)2 TreeMap (java.util.TreeMap)2 AssessmentEntryImpl (org.olat.modules.assessment.model.AssessmentEntryImpl)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2