use of uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice in project openolat by klemens.
the class TrueFalseEditorController method doAddSourceRow.
private void doAddSourceRow(UserRequest ureq) {
SimpleAssociableChoice newChoice = createSimpleAssociableChoice("Text", itemBuilder.getSourceMatchSet());
itemBuilder.getSourceMatchSet().getSimpleAssociableChoices().add(newChoice);
wrapSource(ureq, newChoice, sourceWrappers);
answersCont.setDirty(true);
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice in project openolat by klemens.
the class TrueFalseEditorController method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (readOnly)
return;
// title
itemBuilder.setTitle(titleEl.getValue());
// question
String questionText = textEl.getRawValue();
itemBuilder.setQuestion(questionText);
if (!restrictedEdit) {
itemBuilder.setMultipleChoice(false);
itemBuilder.setShuffle(false);
}
// update
for (SourceWrapper sourceWrapper : sourceWrappers) {
SimpleAssociableChoice choice = sourceWrapper.getSimpleChoice();
String answer = sourceWrapper.getText().getRawValue();
itemBuilder.getHtmlHelper().appendHtml(choice, answer);
}
// correct answers
commitAssociations(ureq);
fireEvent(ureq, new AssessmentItemEvent(AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED, itemBuilder.getAssessmentItem(), QTI21QuestionType.match));
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice in project openolat by klemens.
the class KPrimEditorController method updateMatch.
private void updateMatch(UserRequest ureq) {
for (KprimWrapper choiceWrapper : choiceWrappers) {
SimpleAssociableChoice choice = choiceWrapper.getSimpleChoice();
Identifier choiceIdentifier = choice.getIdentifier();
String association = ureq.getHttpReq().getParameter(choiceIdentifier.toString());
if (StringHelper.containsNonWhitespace(association)) {
if ("correct".equals(association)) {
itemBuilder.setAssociation(choiceIdentifier, QTI21Constants.CORRECT_IDENTIFIER);
} else if ("wrong".equals(association)) {
itemBuilder.setAssociation(choiceIdentifier, QTI21Constants.WRONG_IDENTIFIER);
}
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice in project openolat by klemens.
the class KPrimStatisticsController method getKPrim.
public Series getKPrim() {
List<KPrimStatistics> statisticResponses = qtiStatisticsManager.getKPrimStatistics(itemRef.getIdentifier().toString(), assessmentItem, interaction, resourceResult.getSearchParams());
// TODO String mediaBaseURL = resourceResult.getMediaBaseURL();
boolean survey = QTIType.survey.equals(resourceResult.getType());
int numOfParticipants = resourceResult.getQTIStatisticAssessment().getNumOfParticipants();
List<SimpleMatchSet> matchSets = interaction.getSimpleMatchSets();
SimpleMatchSet fourMatchSet = matchSets.get(0);
int i = 0;
BarSeries d1 = new BarSeries("bar_green", "green", translate("answer.correct"));
BarSeries d2 = new BarSeries("bar_red", "red", translate("answer.false"));
BarSeries d3 = new BarSeries("bar_grey", "grey", translate("answer.noanswer"));
List<ResponseInfos> responseInfos = new ArrayList<>();
for (KPrimStatistics statisticResponse : statisticResponses) {
Identifier choiceIdentifier = statisticResponse.getChoiceIdentifier();
boolean correctRight = statisticResponse.isCorrectRight();
double right = statisticResponse.getNumOfCorrect();
double wrong = statisticResponse.getNumOfIncorrect();
double notanswered = numOfParticipants - right - wrong;
String label = Integer.toString(++i);
d1.add(right, label);
d2.add(wrong, label);
d3.add(notanswered, label);
String text = "";
for (SimpleAssociableChoice choice : fourMatchSet.getSimpleAssociableChoices()) {
if (choice.getIdentifier().equals(choiceIdentifier)) {
String textFlow = assessmentHtmlBuilder.flowStaticString(choice.getFlowStatics());
text = Formatter.formatLatexFormulas(textFlow);
}
}
responseInfos.add(new ResponseInfos(label, text, null, correctRight, survey, true));
}
List<BarSeries> serieList = new ArrayList<>(3);
serieList.add(d1);
serieList.add(d2);
serieList.add(d3);
Series series = new Series(serieList, responseInfos, numOfParticipants, !survey);
series.setChartType(survey ? SeriesFactory.BAR_ANSWERED : SeriesFactory.BAR_CORRECT_WRONG_NOT);
series.setItemCss("o_mi_qtikprim");
return series;
}
Aggregations