Search in sources :

Example 36 with FloatValue

use of uk.ac.ed.ph.jqtiplus.value.FloatValue in project openolat by klemens.

the class AssessmentTestComponentRenderer method renderMaxScoreItem.

protected void renderMaxScoreItem(StringOutput sb, AssessmentTestComponent component, ItemSessionState itemSessionState, Translator translator) {
    if (component.isMaxScoreAssessmentItem()) {
        Value val = itemSessionState.getOutcomeValue(QTI21Constants.MAXSCORE_IDENTIFIER);
        if (val != null && val instanceof FloatValue) {
            double dVal = ((FloatValue) val).doubleValue();
            if (dVal > 0.0d) {
                String sVal;
                if (dVal < 2.0) {
                    sVal = translator.translate("assessment.item.point", new String[] { AssessmentHelper.getRoundedScore(dVal) });
                } else {
                    sVal = translator.translate("assessment.item.points", new String[] { AssessmentHelper.getRoundedScore(dVal) });
                }
                sb.append("<span class='o_qti_item_max_score'>").append(sVal).append("</span>");
            }
        }
    }
}
Also used : FloatValue(uk.ac.ed.ph.jqtiplus.value.FloatValue) Value(uk.ac.ed.ph.jqtiplus.value.Value) FloatValue(uk.ac.ed.ph.jqtiplus.value.FloatValue) AssessmentRenderFunctions.contentAsString(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.contentAsString)

Aggregations

FloatValue (uk.ac.ed.ph.jqtiplus.value.FloatValue)36 BaseValue (uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue)16 OutcomeDeclaration (uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)14 Value (uk.ac.ed.ph.jqtiplus.value.Value)14 FieldValue (uk.ac.ed.ph.jqtiplus.node.shared.FieldValue)12 DefaultValue (uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue)12 SetOutcomeValue (uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue)10 IdentifierValue (uk.ac.ed.ph.jqtiplus.value.IdentifierValue)10 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)8 Map (java.util.Map)8 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)8 File (java.io.File)6 FileOutputStream (java.io.FileOutputStream)6 IOException (java.io.IOException)6 URISyntaxException (java.net.URISyntaxException)6 Test (org.junit.Test)6 JqtiExtensionManager (uk.ac.ed.ph.jqtiplus.JqtiExtensionManager)6 Variable (uk.ac.ed.ph.jqtiplus.node.expression.general.Variable)6 Equal (uk.ac.ed.ph.jqtiplus.node.expression.operator.Equal)6