use of uk.ac.ed.ph.jqtiplus.value.ListValue in project OpenOLAT by OpenOLAT.
the class AssessmentObjectVelocityRenderDecorator method getRespondedVisibleChoices.
/*
<xsl:variable name="respondedChoiceIdentifiers" select="qw:extract-iterable-elements(qw:get-response-value(/, @responseIdentifier))" as="xs:string*"/>
<xsl:variable name="unselectedVisibleChoices" select="$visibleOrderedChoices[not(@identifier = $respondedChoiceIdentifiers)]" as="element(qti:simpleChoice)*"/>
<xsl:variable name="respondedVisibleChoices" as="element(qti:simpleChoice)*">
<xsl:for-each select="$respondedChoiceIdentifiers">
<xsl:sequence select="$thisInteraction/qti:simpleChoice[@identifier=current() and qw:is-visible(.)]"/>
</xsl:for-each>
</xsl:variable>
*/
public OrderChoices getRespondedVisibleChoices(OrderInteraction interaction) {
List<SimpleChoice> visibleChoices = getVisibleOrderedSimpleChoices(interaction);
Value responseValue = getResponseValue(interaction.getResponseIdentifier());
List<String> responseIdentifiers = new ArrayList<>();
if (responseValue instanceof ListValue) {
for (SingleValue singleValue : (ListValue) responseValue) {
responseIdentifiers.add(singleValue.toQtiString());
}
}
List<SimpleChoice> unselectedVisibleChoices = new ArrayList<>(visibleChoices);
for (Iterator<SimpleChoice> it = unselectedVisibleChoices.iterator(); it.hasNext(); ) {
SimpleChoice choice = it.next();
if (responseIdentifiers.contains(choice.getIdentifier().toString())) {
it.remove();
}
}
List<SimpleChoice> respondedVisibleChoices = new ArrayList<>();
for (String responseIdentifier : responseIdentifiers) {
for (SimpleChoice visibleChoice : visibleChoices) {
if (responseIdentifier.equals(visibleChoice.getIdentifier().toString())) {
respondedVisibleChoices.add(visibleChoice);
}
}
}
return new OrderChoices(respondedVisibleChoices, unselectedVisibleChoices);
}
use of uk.ac.ed.ph.jqtiplus.value.ListValue in project openolat by klemens.
the class AssessmentObjectVelocityRenderDecorator method getRespondedVisibleChoices.
/*
<xsl:variable name="respondedChoiceIdentifiers" select="qw:extract-iterable-elements(qw:get-response-value(/, @responseIdentifier))" as="xs:string*"/>
<xsl:variable name="unselectedVisibleChoices" select="$visibleOrderedChoices[not(@identifier = $respondedChoiceIdentifiers)]" as="element(qti:simpleChoice)*"/>
<xsl:variable name="respondedVisibleChoices" as="element(qti:simpleChoice)*">
<xsl:for-each select="$respondedChoiceIdentifiers">
<xsl:sequence select="$thisInteraction/qti:simpleChoice[@identifier=current() and qw:is-visible(.)]"/>
</xsl:for-each>
</xsl:variable>
*/
public OrderChoices getRespondedVisibleChoices(OrderInteraction interaction) {
List<SimpleChoice> visibleChoices = getVisibleOrderedSimpleChoices(interaction);
Value responseValue = getResponseValue(interaction.getResponseIdentifier());
List<String> responseIdentifiers = new ArrayList<>();
if (responseValue instanceof ListValue) {
for (SingleValue singleValue : (ListValue) responseValue) {
responseIdentifiers.add(singleValue.toQtiString());
}
}
List<SimpleChoice> unselectedVisibleChoices = new ArrayList<>(visibleChoices);
for (Iterator<SimpleChoice> it = unselectedVisibleChoices.iterator(); it.hasNext(); ) {
SimpleChoice choice = it.next();
if (responseIdentifiers.contains(choice.getIdentifier().toString())) {
it.remove();
}
}
List<SimpleChoice> respondedVisibleChoices = new ArrayList<>();
for (String responseIdentifier : responseIdentifiers) {
for (SimpleChoice visibleChoice : visibleChoices) {
if (responseIdentifier.equals(visibleChoice.getIdentifier().toString())) {
respondedVisibleChoices.add(visibleChoice);
}
}
}
return new OrderChoices(respondedVisibleChoices, unselectedVisibleChoices);
}
Aggregations