use of uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction in project openolat by klemens.
the class AlienItemAnalyzer method checkKprim.
private void checkKprim(Report report) {
List<Interaction> interactions = item.getItemBody().findInteractions();
if (interactions != null && interactions.size() == 1) {
Interaction interaction = interactions.get(0);
if (interaction instanceof MatchInteraction) {
report.addAlternative(QTI21QuestionType.match);
report.addAlternative(QTI21QuestionType.matchdraganddrop);
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction in project openolat by klemens.
the class AssessmentObjectVelocityRenderDecorator method getVisibleOrderedSimpleChoices.
public List<SimpleChoice> getVisibleOrderedSimpleChoices(OrderInteraction interaction) {
List<SimpleChoice> choices;
if (interaction.getShuffle()) {
// <xsl:variable name="shuffledChoiceOrders" select="$itemSessionState/qw:shuffledInteractionChoiceOrder"
// as="element(qw:shuffledInteractionChoiceOrder)*"/>
// <xsl:variable name="choiceSequence" as="xs:string?"
// select="$shuffledChoiceOrders[@responseIdentifier=$interaction/@responseIdentifier]/@choiceSequence"/>
List<Identifier> choiceOrders = itemSessionState.getShuffledInteractionChoiceOrder(interaction.getResponseIdentifier());
choices = new ArrayList<>();
for (Identifier choiceOrder : choiceOrders) {
choices.add(interaction.getSimpleChoice(choiceOrder));
}
} else {
choices = interaction.getSimpleChoices();
}
return choices.stream().filter((choice) -> isVisible(choice, itemSessionState)).collect(Collectors.toList());
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction in project openolat by klemens.
the class AssessmentObjectVelocityRenderDecorator method getVisibleOrderedChoices.
public List<GapChoice> getVisibleOrderedChoices(GapMatchInteraction interaction) {
List<GapChoice> choices;
if (interaction.getShuffle()) {
// <xsl:variable name="shuffledChoiceOrders" select="$itemSessionState/qw:shuffledInteractionChoiceOrder"
// as="element(qw:shuffledInteractionChoiceOrder)*"/>
// <xsl:variable name="choiceSequence" as="xs:string?"
// select="$shuffledChoiceOrders[@responseIdentifier=$interaction/@responseIdentifier]/@choiceSequence"/>
List<Identifier> choiceOrders = itemSessionState.getShuffledInteractionChoiceOrder(interaction.getResponseIdentifier());
choices = new ArrayList<>();
for (Identifier choiceOrder : choiceOrders) {
choices.add(interaction.getGapChoice(choiceOrder));
}
} else {
choices = new ArrayList<>(interaction.getGapChoices());
}
return choices.stream().filter((choice) -> isVisible(choice, itemSessionState)).collect(Collectors.toList());
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction in project openolat by klemens.
the class AssessmentObjectVelocityRenderDecorator method getVisibleOrderedChoices.
/*
<xsl:function name="qw:get-visible-ordered-choices" as="element()*">
<xsl:param name="interaction" as="element()"/>
<xsl:param name="choices" as="element()*"/>
<xsl:variable name="orderedChoices" as="element()*">
<xsl:choose>
<xsl:when test="$interaction/@shuffle='true'">
<xsl:for-each select="qw:get-shuffled-choice-order($interaction)">
<xsl:sequence select="$choices[@identifier=current()]"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="$choices"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:sequence select="qw:filter-visible($orderedChoices)"/>
</xsl:function>
*/
public List<InlineChoice> getVisibleOrderedChoices(InlineChoiceInteraction interaction) {
List<InlineChoice> choices;
if (interaction.getShuffle()) {
// <xsl:variable name="shuffledChoiceOrders" select="$itemSessionState/qw:shuffledInteractionChoiceOrder"
// as="element(qw:shuffledInteractionChoiceOrder)*"/>
// <xsl:variable name="choiceSequence" as="xs:string?"
// select="$shuffledChoiceOrders[@responseIdentifier=$interaction/@responseIdentifier]/@choiceSequence"/>
List<Identifier> choiceOrders = itemSessionState.getShuffledInteractionChoiceOrder(interaction.getResponseIdentifier());
choices = new ArrayList<>();
for (Identifier choiceOrder : choiceOrders) {
choices.add(interaction.getInlineChoice(choiceOrder));
}
} else {
choices = interaction.getInlineChoices();
}
return choices.stream().filter((choice) -> isVisible(choice, itemSessionState)).collect(Collectors.toList());
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction in project openolat by klemens.
the class AssessmentTestComponent method willShowFeedbacks.
/**
* Check if the assessment item will show some
* form of feedback like feedbackElement, modalFeedback
* or message as invalid or bad response.
*
* @param itemNode
* @return
*/
public boolean willShowFeedbacks(TestPlanNode itemNode) {
if (isHideFeedbacks()) {
return false;
}
try {
URI itemSystemId = itemNode.getItemSystemId();
ResolvedAssessmentItem resolvedAssessmentItem = getResolvedAssessmentTest().getResolvedAssessmentItemBySystemIdMap().get(itemSystemId);
AssessmentItem assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
if (assessmentItem.getAdaptive()) {
return true;
}
ItemSessionState itemSessionState = getItemSessionState(itemNode.getKey());
if (!itemSessionState.isResponded()) {
return true;
}
ItemProcessingContext itemContext = getTestSessionController().getItemProcessingContext(itemNode);
if (itemContext instanceof ItemSessionController) {
ItemSessionController itemSessionController = (ItemSessionController) itemContext;
List<Interaction> interactions = itemSessionController.getInteractions();
for (Interaction interaction : interactions) {
if (AssessmentRenderFunctions.isBadResponse(itemSessionState, interaction.getResponseIdentifier())) {
return true;
}
if (AssessmentRenderFunctions.isInvalidResponse(itemSessionState, interaction.getResponseIdentifier())) {
return true;
}
}
}
if (assessmentItem.getItemBody().willShowFeedback(itemContext)) {
return true;
}
List<ModalFeedback> modalFeedbacks = assessmentItem.getModalFeedbacks();
for (ModalFeedback modalFeedback : modalFeedbacks) {
if (isFeedback(modalFeedback, itemSessionState)) {
return true;
}
}
} catch (Exception e) {
log.error("", e);
}
return false;
}
Aggregations