Skip to content
Snippets Groups Projects
Commit 7223c263 authored by srosse's avatar srosse
Browse files

OO-3949: the mapper is already at assessment item file level

parent 2c902a6d
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,6 @@ import org.olat.ims.qti.statistics.model.StatisticsItem;
import org.olat.ims.qti21.QTI21StatisticsManager;
import org.olat.ims.qti21.manager.CorrectResponsesUtil;
import org.olat.ims.qti21.model.statistics.ChoiceStatistics;
import org.olat.ims.qti21.ui.components.FlowComponent;
import org.olat.ims.qti21.ui.statistics.QTI21AssessmentItemStatisticsController;
import org.olat.ims.qti21.ui.statistics.QTI21StatisticResourceResult;
import org.olat.ims.qti21.ui.statistics.SeriesFactory;
......@@ -130,7 +129,7 @@ public abstract class ChoiceInteractionStatisticsController extends BasicControl
List<ResponseInfos> responseInfos = new ArrayList<>();
for (ChoiceStatistics statisticResponse:statisticResponses) {
Choice choice = statisticResponse.getChoice();
FlowComponent text = getAnswerText(choice);
Component text = getAnswerText(choice);
double ansCount = statisticResponse.getCount();
numOfResults += statisticResponse.getCount();
boolean correct = correctAnswers.contains(choice.getIdentifier());
......@@ -189,7 +188,7 @@ public abstract class ChoiceInteractionStatisticsController extends BasicControl
List<ResponseInfos> responseInfos = new ArrayList<>();
for(ChoiceStatistics statisticResponse:statisticResponses) {
Choice choice = statisticResponse.getChoice();
FlowComponent text = getAnswerText(choice);
Component text = getAnswerText(choice);
boolean correct = correctAnswers.contains(choice.getIdentifier());
double answersPerAnswerOption = statisticResponse.getCount();
......@@ -242,7 +241,7 @@ public abstract class ChoiceInteractionStatisticsController extends BasicControl
protected abstract List<ChoiceStatistics> getChoiceInteractionStatistics();
protected abstract FlowComponent getAnswerText(Choice choice);
protected abstract Component getAnswerText(Choice choice);
}
......@@ -22,7 +22,10 @@ package org.olat.ims.qti21.ui.statistics.interactions;
import java.util.List;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.text.TextFactory;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.util.StringHelper;
import org.olat.ims.qti.statistics.model.StatisticsItem;
import org.olat.ims.qti21.model.statistics.ChoiceStatistics;
import org.olat.ims.qti21.ui.components.FlowComponent;
......@@ -56,20 +59,20 @@ public class HottextInteractionStatisticsController extends ChoiceInteractionSta
}
@Override
protected FlowComponent getAnswerText(Choice choice) {
protected Component getAnswerText(Choice choice) {
String cmpId = "hot_" + (count++);
FlowComponent cmp = new FlowComponent(cmpId, resourceResult.getAssessmentItemFile(itemRef));
cmp.setMapperUri(mapperUri);
cmp.setInlineStatics(((Hottext)choice).getInlineStatics());
cmp.setResolvedAssessmentTest(resourceResult.getResolvedAssessmentTest());
mainVC.put(cmpId, cmp);
/*String text = choice.getLabel();
if(!StringHelper.containsNonWhitespace(text)) {
text = new AssessmentHtmlBuilder().inlineStaticString(((Hottext)choice).getInlineStatics());
text = Formatter.formatLatexFormulas(text);
}*/
return cmp;
Component textCmp;
String text = choice.getLabel();
if(StringHelper.containsNonWhitespace(text)) {
textCmp = TextFactory.createTextComponentFromString(cmpId, text, null, true, null);
} else {
FlowComponent cmp = new FlowComponent(cmpId, resourceResult.getAssessmentItemFile(itemRef));
cmp.setMapperUri(mapperUri);
cmp.setInlineStatics(((Hottext)choice).getInlineStatics());
textCmp = cmp;
}
mainVC.put(cmpId, textCmp);
return textCmp;
}
}
......@@ -131,7 +131,6 @@ public class KPrimStatisticsController extends BasicController {
text = new FlowComponent(textName, resourceResult.getAssessmentItemFile(itemRef));
text.setFlowStatics(choice.getFlowStatics());
text.setMapperUri(mapperUri);
text.setResolvedAssessmentTest(resourceResult.getResolvedAssessmentTest());
mainVC.put(textName, text);
}
}
......
......@@ -241,7 +241,6 @@ public class MatchStatisticsController extends BasicController {
summary = new FlowComponent(summaryName, resourceResult.getAssessmentItemFile(itemRef));
summary.setMapperUri(mapperUri);
summary.setFlowStatics(choice.getFlowStatics());
summary.setResolvedAssessmentTest(resourceResult.getResolvedAssessmentTest());
mainVC.put(summaryName, summary);
}
......
......@@ -22,9 +22,9 @@ package org.olat.ims.qti21.ui.statistics.interactions;
import java.util.Collections;
import java.util.List;
import org.olat.core.gui.components.Component;
import org.olat.core.util.StringHelper;
import org.olat.course.assessment.AssessmentHelper;
import org.olat.ims.qti21.ui.components.FlowComponent;
/**
*
......@@ -36,7 +36,7 @@ public class ResponseInfos {
private final String label;
private final String text;
private final FlowComponent textComponent;
private final Component textComponent;
private final Float points;
private final boolean correct;
private final boolean survey;
......@@ -44,11 +44,11 @@ public class ResponseInfos {
private final List<String> wrongAnswers;
public ResponseInfos(String label, FlowComponent textComponent, Float points, boolean correct, boolean survey, boolean kprim) {
public ResponseInfos(String label, Component textComponent, Float points, boolean correct, boolean survey, boolean kprim) {
this(label, null, textComponent, Collections.<String>emptyList(), points, correct, survey, kprim);
}
public ResponseInfos(String label, String text, FlowComponent textComponent, List<String> wrongAnswers, Float points,
public ResponseInfos(String label, String text, Component textComponent, List<String> wrongAnswers, Float points,
boolean correct, boolean survey, boolean kprim) {
this.label = label;
this.text = text;
......@@ -68,7 +68,7 @@ public class ResponseInfos {
return text;
}
public FlowComponent getTextComponent() {
public Component getTextComponent() {
return textComponent;
}
......
......@@ -22,7 +22,10 @@ package org.olat.ims.qti21.ui.statistics.interactions;
import java.util.List;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.text.TextFactory;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.util.StringHelper;
import org.olat.ims.qti.statistics.model.StatisticsItem;
import org.olat.ims.qti21.model.statistics.ChoiceStatistics;
import org.olat.ims.qti21.ui.components.FlowComponent;
......@@ -55,21 +58,20 @@ public class SimpleChoiceInteractionStatisticsController extends ChoiceInteracti
}
@Override
protected FlowComponent getAnswerText(Choice choice) {
protected Component getAnswerText(Choice choice) {
String cmpId = "sc_" + (count++);
FlowComponent cmp = new FlowComponent(cmpId, resourceResult.getAssessmentItemFile(itemRef));
cmp.setMapperUri(mapperUri);
cmp.setFlowStatics(((SimpleChoice)choice).getFlowStatics());
cmp.setResolvedAssessmentTest(resourceResult.getResolvedAssessmentTest());
mainVC.put(cmpId, cmp);
/*
String text = choice.getLabel();
if(!StringHelper.containsNonWhitespace(text)) {
text = new AssessmentHtmlBuilder().flowStaticString(((SimpleChoice)choice).getFlowStatics());
text = Formatter.formatLatexFormulas(text);
Component textCmp;
if(StringHelper.containsNonWhitespace(text)) {
textCmp = TextFactory.createTextComponentFromString(cmpId, text, null, true, null);
} else {
FlowComponent cmp = new FlowComponent(cmpId, resourceResult.getAssessmentItemFile(itemRef));
cmp.setMapperUri(mapperUri);
cmp.setFlowStatics(((SimpleChoice)choice).getFlowStatics());
textCmp = cmp;
}
*/
return cmp;
mainVC.put(cmpId, textCmp);
return textCmp;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment