use of uk.ac.ed.ph.jqtiplus.group.NodeGroupList in project openolat by klemens.
the class AssessmentItemFactory method appendDefaultOutcomeDeclarations.
/**
* Append the default outcome declaration for score, max score and feedback basic.
*
* @param assessmentItem
*/
public static void appendDefaultOutcomeDeclarations(AssessmentItem assessmentItem, double maxScore) {
NodeGroupList nodeGroups = assessmentItem.getNodeGroups();
// outcomes
OutcomeDeclarationGroup outcomeDeclarations = nodeGroups.getOutcomeDeclarationGroup();
// outcome score
OutcomeDeclaration scoreOutcomeDeclaration = createOutcomeDeclarationForScore(assessmentItem);
outcomeDeclarations.getOutcomeDeclarations().add(scoreOutcomeDeclaration);
// outcome max score
OutcomeDeclaration maxScoreOutcomeDeclaration = createOutcomeDeclarationForMaxScore(assessmentItem, maxScore);
outcomeDeclarations.getOutcomeDeclarations().add(maxScoreOutcomeDeclaration);
// outcome min score
OutcomeDeclaration minScoreOutcomeDeclaration = createOutcomeDeclarationForMinScore(assessmentItem, 0.0d);
outcomeDeclarations.getOutcomeDeclarations().add(minScoreOutcomeDeclaration);
// outcome feedback
OutcomeDeclaration feedbackOutcomeDeclaration = createOutcomeDeclarationForFeedbackBasic(assessmentItem);
outcomeDeclarations.getOutcomeDeclarations().add(feedbackOutcomeDeclaration);
}
use of uk.ac.ed.ph.jqtiplus.group.NodeGroupList in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method appendDefaultOutcomeDeclarations.
/**
* Append the default outcome declaration for score, max score and feedback basic.
*
* @param assessmentItem
*/
public static void appendDefaultOutcomeDeclarations(AssessmentItem assessmentItem, double maxScore) {
NodeGroupList nodeGroups = assessmentItem.getNodeGroups();
// outcomes
OutcomeDeclarationGroup outcomeDeclarations = nodeGroups.getOutcomeDeclarationGroup();
// outcome score
OutcomeDeclaration scoreOutcomeDeclaration = createOutcomeDeclarationForScore(assessmentItem);
outcomeDeclarations.getOutcomeDeclarations().add(scoreOutcomeDeclaration);
// outcome max score
OutcomeDeclaration maxScoreOutcomeDeclaration = createOutcomeDeclarationForMaxScore(assessmentItem, maxScore);
outcomeDeclarations.getOutcomeDeclarations().add(maxScoreOutcomeDeclaration);
// outcome min score
OutcomeDeclaration minScoreOutcomeDeclaration = createOutcomeDeclarationForMinScore(assessmentItem, 0.0d);
outcomeDeclarations.getOutcomeDeclarations().add(minScoreOutcomeDeclaration);
// outcome feedback
OutcomeDeclaration feedbackOutcomeDeclaration = createOutcomeDeclarationForFeedbackBasic(assessmentItem);
outcomeDeclarations.getOutcomeDeclarations().add(feedbackOutcomeDeclaration);
}
use of uk.ac.ed.ph.jqtiplus.group.NodeGroupList in project openolat by klemens.
the class KPrimAssessmentItemBuilder method createAssessmentItem.
private static AssessmentItem createAssessmentItem(String title, String defaultAnswer) {
AssessmentItem assessmentItem = AssessmentItemFactory.createAssessmentItem(QTI21QuestionType.kprim, title);
NodeGroupList nodeGroups = assessmentItem.getNodeGroups();
double maxScore = 1.0d;
Identifier responseDeclarationId = Identifier.assumedLegal("KPRIM_RESPONSE_1");
// define correct answer
ResponseDeclaration responseDeclaration = createKPrimResponseDeclaration(assessmentItem, responseDeclarationId, new HashMap<>(), maxScore);
nodeGroups.getResponseDeclarationGroup().getResponseDeclarations().add(responseDeclaration);
appendDefaultOutcomeDeclarations(assessmentItem, maxScore);
// the single choice interaction
ItemBody itemBody = appendDefaultItemBody(assessmentItem);
MatchInteraction matchInteraction = appendMatchInteractionForKPrim(itemBody, responseDeclarationId, defaultAnswer);
List<String> cssClasses = new ArrayList<>();
cssClasses.add(QTI21Constants.CSS_MATCH_KPRIM);
matchInteraction.setClassAttr(cssClasses);
SimpleMatchSet matchSet = matchInteraction.getSimpleMatchSets().get(0);
Map<Identifier, Identifier> associations = new HashMap<>();
for (SimpleAssociableChoice choice : matchSet.getSimpleAssociableChoices()) {
associations.put(choice.getIdentifier(), QTI21Constants.WRONG_IDENTIFIER);
}
appendAssociationKPrimResponseDeclaration(responseDeclaration, associations, 1.0);
// response processing
ResponseProcessing responseProcessing = createResponseProcessing(assessmentItem, responseDeclarationId);
assessmentItem.getNodeGroups().getResponseProcessingGroup().setResponseProcessing(responseProcessing);
return assessmentItem;
}
use of uk.ac.ed.ph.jqtiplus.group.NodeGroupList in project openolat by klemens.
the class MultipleChoiceAssessmentItemBuilder method createAssessmentItem.
private static AssessmentItem createAssessmentItem(String title, String defaultAnswer) {
AssessmentItem assessmentItem = AssessmentItemFactory.createAssessmentItem(QTI21QuestionType.mc, title);
NodeGroupList nodeGroups = assessmentItem.getNodeGroups();
Identifier responseDeclarationId = Identifier.assumedLegal("RESPONSE_1");
Identifier correctResponseId = IdentifierGenerator.newAsIdentifier("mc");
// define correct answer
ResponseDeclaration responseDeclaration = createMultipleChoiceCorrectResponseDeclaration(assessmentItem, responseDeclarationId, Collections.singletonList(correctResponseId));
nodeGroups.getResponseDeclarationGroup().getResponseDeclarations().add(responseDeclaration);
// outcomes
appendDefaultOutcomeDeclarations(assessmentItem, 1.0d);
// the single choice interaction
ItemBody itemBody = appendDefaultItemBody(assessmentItem);
ChoiceInteraction choiceInteraction = appendChoiceInteraction(itemBody, responseDeclarationId, 0, true);
appendSimpleChoice(choiceInteraction, defaultAnswer, correctResponseId);
// response processing
ResponseProcessing responseProcessing = createResponseProcessing(assessmentItem, responseDeclarationId);
assessmentItem.getNodeGroups().getResponseProcessingGroup().setResponseProcessing(responseProcessing);
return assessmentItem;
}
use of uk.ac.ed.ph.jqtiplus.group.NodeGroupList in project openolat by klemens.
the class AssessmentItemFactory method appendDefaultItemBody.
/**
* Append the itemBody with an empty paragraph.
*
* @param assessmentItem
* @return
*/
public static ItemBody appendDefaultItemBody(AssessmentItem assessmentItem) {
NodeGroupList nodeGroups = assessmentItem.getNodeGroups();
// the single choice interaction
ItemBodyGroup itemBodyGroup = nodeGroups.getItemBodyGroup();
ItemBody itemBody = new ItemBody(assessmentItem);
itemBodyGroup.setItemBody(itemBody);
return itemBody;
}
Aggregations