Search in sources :

Example 51 with OutcomeDeclaration

use of uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration in project openolat by klemens.

the class AssessmentTestComponentRenderer method renderPrintedVariable.

@Override
protected void renderPrintedVariable(AssessmentRenderer renderer, StringOutput sb, AssessmentObjectComponent component, ResolvedAssessmentItem resolvedAssessmentItem, ItemSessionState itemSessionState, PrintedVariable printedVar) {
    AssessmentTestComponent testCmp = (AssessmentTestComponent) component;
    Identifier identifier = printedVar.getIdentifier();
    sb.append("<span class='printedVariable'>");
    if (itemSessionState == null) {
        Value outcomeValue = testCmp.getTestSessionController().getTestSessionState().getOutcomeValue(identifier);
        if (outcomeValue != null) {
            OutcomeDeclaration outcomeDeclaration = testCmp.getAssessmentTest().getOutcomeDeclaration(identifier);
            renderPrintedVariable(renderer, sb, printedVar, outcomeDeclaration, outcomeValue);
        }
    } else {
        Value templateValue = itemSessionState.getTemplateValues().get(identifier);
        Value outcomeValue = itemSessionState.getOutcomeValues().get(identifier);
        if (outcomeValue != null) {
            OutcomeDeclaration outcomeDeclaration = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful().getOutcomeDeclaration(identifier);
            renderPrintedVariable(renderer, sb, printedVar, outcomeDeclaration, outcomeValue);
        } else if (templateValue != null) {
            TemplateDeclaration templateDeclaration = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful().getTemplateDeclaration(identifier);
            renderPrintedVariable(renderer, sb, printedVar, templateDeclaration, templateValue);
        } else {
            sb.append("(variable ").append(identifier.toString()).append(" was not found)");
        }
    }
    sb.append("</span>");
}
Also used : Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) FloatValue(uk.ac.ed.ph.jqtiplus.value.FloatValue) Value(uk.ac.ed.ph.jqtiplus.value.Value) TemplateDeclaration(uk.ac.ed.ph.jqtiplus.node.item.template.declaration.TemplateDeclaration) OutcomeDeclaration(uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)

Example 52 with OutcomeDeclaration

use of uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration in project openolat by klemens.

the class AssessmentItemComponentRenderer method renderPrintedVariable.

@Override
protected void renderPrintedVariable(AssessmentRenderer renderer, StringOutput sb, AssessmentObjectComponent component, ResolvedAssessmentItem resolvedAssessmentItem, ItemSessionState itemSessionState, PrintedVariable printedVar) {
    Identifier identifier = printedVar.getIdentifier();
    Value templateValue = itemSessionState.getTemplateValues().get(identifier);
    Value outcomeValue = itemSessionState.getOutcomeValues().get(identifier);
    sb.append("<span class='printedVariable'>");
    if (outcomeValue != null) {
        OutcomeDeclaration outcomeDeclaration = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful().getOutcomeDeclaration(identifier);
        renderPrintedVariable(renderer, sb, printedVar, outcomeDeclaration, outcomeValue);
    } else if (templateValue != null) {
        TemplateDeclaration templateDeclaration = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful().getTemplateDeclaration(identifier);
        renderPrintedVariable(renderer, sb, printedVar, templateDeclaration, templateValue);
    } else {
        sb.append("(variable ").append(identifier.toString()).append(" was not found)");
    }
    sb.append("</span>");
}
Also used : Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) Value(uk.ac.ed.ph.jqtiplus.value.Value) TemplateDeclaration(uk.ac.ed.ph.jqtiplus.node.item.template.declaration.TemplateDeclaration) OutcomeDeclaration(uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)

Aggregations

OutcomeDeclaration (uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)52 DefaultValue (uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue)18 FloatValue (uk.ac.ed.ph.jqtiplus.value.FloatValue)16 FieldValue (uk.ac.ed.ph.jqtiplus.node.shared.FieldValue)14 ArrayList (java.util.ArrayList)12 BaseValue (uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue)10 View (uk.ac.ed.ph.jqtiplus.node.test.View)10 SetOutcomeValue (uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue)8 IdentifierValue (uk.ac.ed.ph.jqtiplus.value.IdentifierValue)8 Value (uk.ac.ed.ph.jqtiplus.value.Value)8 ModalFeedback (uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback)6 Variable (uk.ac.ed.ph.jqtiplus.node.expression.general.Variable)4 Sum (uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum)4 ResponseDeclaration (uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration)4 ResponseCondition (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)4 ResponseIf (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf)4 ResponseRule (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseRule)4 TemplateDeclaration (uk.ac.ed.ph.jqtiplus.node.item.template.declaration.TemplateDeclaration)4 SetOutcomeValue (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue)4 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)4