use of uk.ac.ed.ph.jqtiplus.types.Identifier in project OpenOLAT by OpenOLAT.
the class AlienItemAnalyzer method checkFeedback.
private void checkFeedback(Report report) {
if (item.getModalFeedbacks() != null && item.getModalFeedbacks().size() > 0) {
Set<Identifier> outcomeIdentifiers = new HashSet<>();
List<ModalFeedback> feedbacks = item.getModalFeedbacks();
for (ModalFeedback feedback : feedbacks) {
if (feedback.getOutcomeIdentifier() != null) {
outcomeIdentifiers.add(feedback.getOutcomeIdentifier());
}
}
if (outcomeIdentifiers.size() == 1) {
if (outcomeIdentifiers.iterator().next().equals(QTI21Constants.FEEDBACKMODAL_IDENTIFIER)) {
checkFeedbackModalResponseProcessing(report);
} else {
report.addWarning(ReportWarningEnum.alienFeedbacks);
}
} else {
// Onyx and OpenOLAT only use one outcome identifier for the feedbacks
// Taotesting use several different identifiers. And we don't
// understand feedbacks without outcome identifiers
report.addWarning(ReportWarningEnum.alienFeedbacks);
}
}
}
use of uk.ac.ed.ph.jqtiplus.types.Identifier in project OpenOLAT by OpenOLAT.
the class AssessmentItemBuilder method appendAdditionalFeedback.
protected void appendAdditionalFeedback(ModalFeedbackBuilder feedback, List<ModalFeedback> modalFeedbacks, List<ResponseRule> responseRules) {
Identifier feedbackIdentifier = feedback.getIdentifier();
ModalFeedback modalFeedback = AssessmentItemFactory.createModalFeedback(assessmentItem, feedbackIdentifier, feedback.getTitle(), feedback.getText());
modalFeedbacks.add(modalFeedback);
Cardinality cardinality = null;
Identifier responseIdentifier = null;
if (this instanceof ResponseIdentifierForFeedback) {
responseIdentifier = ((ResponseIdentifierForFeedback) this).getResponseIdentifier();
cardinality = assessmentItem.getResponseDeclaration(responseIdentifier).getCardinality();
}
ResponseCondition feedbackCondition = AssessmentItemFactory.createModalFeedbackRuleWithConditions(assessmentItem.getResponseProcessing(), feedbackIdentifier, responseIdentifier, cardinality, feedback.getFeedbackConditons());
responseRules.add(feedbackCondition);
}
use of uk.ac.ed.ph.jqtiplus.types.Identifier in project OpenOLAT by OpenOLAT.
the class AbstractChoiceInteractionArchive method writeInteractionData.
@Override
public int writeInteractionData(AssessmentItem item, AssessmentResponse response, Interaction interaction, int itemNumber, Row dataRow, int col, OpenXMLWorkbook workbook) {
String stringuifiedResponses = response == null ? null : response.getStringuifiedResponse();
List<Identifier> correctAnswers = CorrectResponsesUtil.getCorrectIdentifierResponses(item, interaction);
List<? extends Choice> choices = getChoices(interaction);
if (StringHelper.containsNonWhitespace(stringuifiedResponses)) {
for (int i = 0; i < choices.size(); i++) {
Identifier choiceIdentifier = choices.get(i).getIdentifier();
if (stringuifiedResponses.contains("[" + choiceIdentifier + "]")) {
if (correctAnswers.contains(choiceIdentifier)) {
// the checked answer is correct
dataRow.addCell(col++, "x", workbook.getStyles().getCorrectStyle());
} else {
dataRow.addCell(col++, "x");
}
} else {
col++;
}
}
} else {
col += choices.size();
}
return col;
}
use of uk.ac.ed.ph.jqtiplus.types.Identifier in project OpenOLAT by OpenOLAT.
the class AuditLogFormatter method log.
protected static void log(CandidateEvent candidateEvent, Map<Identifier, AssessmentResponse> candidateResponseMap, Writer writer) throws IOException {
writer.append("QTI21 audit [");
AssessmentTestSession testSession = candidateEvent.getCandidateSession();
if (testSession != null) {
RepositoryEntryRef testEntry = candidateEvent.getTestEntry();
RepositoryEntryRef courseEntry = candidateEvent.getRepositoryEntry();
if (courseEntry != null && !testEntry.getKey().equals(courseEntry.getKey())) {
writer.write(courseEntry.getKey().toString());
writer.write(":");
if (testSession.getSubIdent() == null) {
writer.write("NULL:");
} else {
writer.write(testSession.getSubIdent());
writer.write(":");
}
}
if (testEntry != null) {
writer.write(testEntry.getKey().toString());
}
}
writer.write("] ");
if (candidateEvent.getTestEventType() != null) {
writer.append("TestEvent:");
writer.append(candidateEvent.getTestEventType().toString());
writer.write(" ");
}
if (candidateEvent.getItemEventType() != null) {
writer.append("ItemEvent:");
writer.append(candidateEvent.getItemEventType().toString());
writer.write(" ");
}
if (candidateEvent.getTestItemKey() != null) {
writer.append("TestItemKey[");
writer.append(candidateEvent.getTestItemKey());
writer.write("] ");
}
if (candidateResponseMap != null) {
writer.write("params=");
for (Map.Entry<Identifier, AssessmentResponse> responseEntry : candidateResponseMap.entrySet()) {
Identifier identifier = responseEntry.getKey();
AssessmentResponse response = responseEntry.getValue();
writer.append("|");
writer.append(identifier.toString());
writer.append("=");
String stringuifiedResponse = response.getStringuifiedResponse();
if (stringuifiedResponse == null) {
writer.append("NULL");
} else {
writer.append(stringuifiedResponse);
}
}
}
}
use of uk.ac.ed.ph.jqtiplus.types.Identifier in project OpenOLAT by OpenOLAT.
the class HottextInteractionArchive method writeInteractionData.
@Override
public int writeInteractionData(AssessmentItem item, AssessmentResponse response, Interaction interaction, int itemNumber, Row dataRow, int col, OpenXMLWorkbook workbook) {
String stringuifiedResponse = response == null ? null : response.getStringuifiedResponse();
List<String> responses = CorrectResponsesUtil.parseResponses(stringuifiedResponse);
List<Identifier> correctAnswers = CorrectResponsesUtil.getCorrectIdentifierResponses(item, interaction);
List<Hottext> texts = getHottexts(interaction);
for (int i = 0; i < texts.size(); i++) {
Hottext text = texts.get(i);
Identifier textIdentifier = text.getIdentifier();
// user select this hot text
if (responses.contains(text.getIdentifier().toString())) {
String content = getContent(text);
// correct -> must be clicked
boolean correct = correctAnswers.contains(textIdentifier);
if (correct) {
dataRow.addCell(col++, content, workbook.getStyles().getCorrectStyle());
} else {
dataRow.addCell(col++, content, null);
}
} else {
// correct -> must not be clicked
boolean correct = !correctAnswers.contains(textIdentifier);
if (correct) {
dataRow.addCell(col++, "", workbook.getStyles().getCorrectStyle());
} else {
col++;
}
}
}
return col;
}
Aggregations