From 39ce41551537f3436e9ade542a5d82c33e42b50e Mon Sep 17 00:00:00 2001 From: uhensler <urs.hensler@frentix.com> Date: Tue, 19 Jun 2018 21:17:49 +0200 Subject: [PATCH] OO-3303: Evaluation form report overview with histogram and more figures --- .../forms/handler/DefaultReportProvider.java | 2 +- .../forms/handler/RubricBarChartsHandler.java | 17 +- .../ui/EvaluationFormOverviewController.java | 22 ++- .../forms/ui/RubricBarChartsController.java | 147 +++++------------- .../ui/RubricSlidersBarChartsController.java | 61 ++++++++ .../ui/RubricTotalBarChartsController.java | 59 +++++++ .../forms/ui/RubricsTotalController.java | 111 ------------- .../forms/ui/RubricsTotalDataModel.java | 71 --------- .../modules/forms/ui/RubricsTotalRow.java | 54 ------- .../forms/ui/_i18n/LocalStrings_de.properties | 2 - .../forms/ui/_i18n/LocalStrings_en.properties | 2 - 11 files changed, 198 insertions(+), 350 deletions(-) create mode 100644 src/main/java/org/olat/modules/forms/ui/RubricSlidersBarChartsController.java create mode 100644 src/main/java/org/olat/modules/forms/ui/RubricTotalBarChartsController.java delete mode 100644 src/main/java/org/olat/modules/forms/ui/RubricsTotalController.java delete mode 100644 src/main/java/org/olat/modules/forms/ui/RubricsTotalDataModel.java delete mode 100644 src/main/java/org/olat/modules/forms/ui/RubricsTotalRow.java diff --git a/src/main/java/org/olat/modules/forms/handler/DefaultReportProvider.java b/src/main/java/org/olat/modules/forms/handler/DefaultReportProvider.java index e17197e2287..8f7d9eb7128 100644 --- a/src/main/java/org/olat/modules/forms/handler/DefaultReportProvider.java +++ b/src/main/java/org/olat/modules/forms/handler/DefaultReportProvider.java @@ -47,7 +47,7 @@ public class DefaultReportProvider implements EvaluationFormReportProvider { handlers.put(Title.TYPE, new TitleHandler()); handlers.put(Spacer.TYPE, new SpacerHandler()); handlers.put(HTMLRaw.TYPE, new HTMLRawHandler()); - handlers.put(Rubric.TYPE, new RubricBarChartsHandler()); + handlers.put(Rubric.TYPE, new RubricBarChartsHandler(false)); handlers.put(TextInput.TYPE, new TextInputLegendTextHandler()); handlers.put(FileUpload.TYPE, new FileUploadListingHandler()); handlers.put(SingleChoice.TYPE, new SingleChoiceBarChartHandler()); diff --git a/src/main/java/org/olat/modules/forms/handler/RubricBarChartsHandler.java b/src/main/java/org/olat/modules/forms/handler/RubricBarChartsHandler.java index 7f1ebe24685..67f035b227e 100644 --- a/src/main/java/org/olat/modules/forms/handler/RubricBarChartsHandler.java +++ b/src/main/java/org/olat/modules/forms/handler/RubricBarChartsHandler.java @@ -28,7 +28,8 @@ import org.olat.core.gui.control.WindowControl; import org.olat.modules.forms.EvaluationFormSessionRef; import org.olat.modules.forms.model.xml.Rubric; import org.olat.modules.forms.ui.ReportHelper; -import org.olat.modules.forms.ui.RubricBarChartsController; +import org.olat.modules.forms.ui.RubricSlidersBarChartsController; +import org.olat.modules.forms.ui.RubricTotalBarChartsController; import org.olat.modules.portfolio.ui.editor.PageElement; /** @@ -39,6 +40,13 @@ import org.olat.modules.portfolio.ui.editor.PageElement; */ public class RubricBarChartsHandler implements EvaluationFormReportHandler { + private boolean totals; + + public RubricBarChartsHandler(boolean totals) { + super(); + this.totals = totals; + } + @Override public String getType() { return "rubricbarcharts"; @@ -49,7 +57,12 @@ public class RubricBarChartsHandler implements EvaluationFormReportHandler { List<? extends EvaluationFormSessionRef> sessions, ReportHelper reportHelper) { if (element instanceof Rubric) { Rubric rubric = (Rubric) element; - Controller ctrl = new RubricBarChartsController(ureq, windowControl, rubric, sessions); + Controller ctrl; + if (totals) { + ctrl = new RubricTotalBarChartsController(ureq, windowControl, rubric, sessions); + } else { + ctrl = new RubricSlidersBarChartsController(ureq, windowControl, rubric, sessions); + } return ctrl.getInitialComponent(); } return null; diff --git a/src/main/java/org/olat/modules/forms/ui/EvaluationFormOverviewController.java b/src/main/java/org/olat/modules/forms/ui/EvaluationFormOverviewController.java index 4a671d9997d..a57b15a42f6 100644 --- a/src/main/java/org/olat/modules/forms/ui/EvaluationFormOverviewController.java +++ b/src/main/java/org/olat/modules/forms/ui/EvaluationFormOverviewController.java @@ -33,10 +33,14 @@ import org.olat.core.gui.control.controller.BasicController; import org.olat.modules.forms.EvaluationFormManager; import org.olat.modules.forms.EvaluationFormSessionRef; import org.olat.modules.forms.EvaluationFormStatistic; +import org.olat.modules.forms.handler.EvaluationFormReportHandler; +import org.olat.modules.forms.handler.EvaluationFormReportProvider; +import org.olat.modules.forms.handler.RubricBarChartsHandler; import org.olat.modules.forms.model.xml.AbstractElement; import org.olat.modules.forms.model.xml.Form; import org.olat.modules.forms.model.xml.Rubric; import org.olat.modules.forms.ui.component.ResponsiveBarChartComponent; +import org.olat.modules.portfolio.ui.editor.PageElement; import org.springframework.beans.factory.annotation.Autowired; /** @@ -47,6 +51,8 @@ import org.springframework.beans.factory.annotation.Autowired; * */ public class EvaluationFormOverviewController extends BasicController { + + private static final OverviewProvider PROVIDER = new OverviewProvider(); private VelocityContainer mainVC; @@ -67,7 +73,7 @@ public class EvaluationFormOverviewController extends BasicController { mainVC.contextPut("averageDuration", EvaluationFormFormatter.duration(statistic.getAverageDuration())); if (hasRubrics(form)) { - Controller reportCtrl = new RubricsTotalController(ureq, getWindowControl(), form, sessions); + Controller reportCtrl = new EvaluationFormReportController(ureq, wControl, form, sessions, PROVIDER, null); mainVC.put("report", reportCtrl.getInitialComponent()); } @@ -167,4 +173,18 @@ public class EvaluationFormOverviewController extends BasicController { } } + private static final class OverviewProvider implements EvaluationFormReportProvider { + + RubricBarChartsHandler rubricBarChartsHandler = new RubricBarChartsHandler(true); + + @Override + public EvaluationFormReportHandler getReportHandler(PageElement element) { + if (Rubric.TYPE.equals(element.getType())) { + return rubricBarChartsHandler; + } + return null; + } + + } + } diff --git a/src/main/java/org/olat/modules/forms/ui/RubricBarChartsController.java b/src/main/java/org/olat/modules/forms/ui/RubricBarChartsController.java index 1277aed3884..5c7751d7672 100644 --- a/src/main/java/org/olat/modules/forms/ui/RubricBarChartsController.java +++ b/src/main/java/org/olat/modules/forms/ui/RubricBarChartsController.java @@ -42,52 +42,46 @@ import org.olat.modules.forms.EvaluationFormSessionRef; import org.olat.modules.forms.model.xml.Rubric; import org.olat.modules.forms.model.xml.Rubric.SliderType; import org.olat.modules.forms.model.xml.Slider; -import org.olat.modules.forms.model.xml.StepLabel; import org.olat.modules.forms.ui.component.ResponsiveBarChartComponent; -import org.olat.modules.forms.ui.model.RubricStatistic; import org.olat.modules.forms.ui.model.SliderStatistic; /** * - * Initial date: 25.05.2018<br> + * Initial date: 19.06.2018<br> * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com * */ -public class RubricBarChartsController extends FormBasicController { +public abstract class RubricBarChartsController extends FormBasicController { private final Rubric rubric; private final List<? extends EvaluationFormSessionRef> sessions; - + public RubricBarChartsController(UserRequest ureq, WindowControl wControl, Rubric rubric, List<? extends EvaluationFormSessionRef> sessions) { super(ureq, wControl, "rubric_bar_charts"); this.rubric = rubric; this.sessions = sessions; - initForm(ureq); + } + + protected abstract RubricWrapper createRubricWrapper(); + + public Rubric getRubric() { + return rubric; + } + + public List<? extends EvaluationFormSessionRef> getSessions() { + return sessions; } @Override protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { flc.contextPut("rubricWrapper", createRubricWrapper()); } - - private RubricWrapper createRubricWrapper() { - RubricStatistic rubricStatistic = new RubricStatistic(rubric, sessions); - List<SliderWrapper> sliderWrappers = new ArrayList<>(); - for (Slider slider: rubric.getSliders()) { - SliderStatistic sliderStatistic = rubricStatistic.getSliderStatistic(slider); - SliderWrapper sliderWrapper = createSliderWrapper(slider, sliderStatistic); - sliderWrappers.add(sliderWrapper); - } - RubricWrapper rubricWrapper = new RubricWrapper(rubric); - rubricWrapper.setSliders(sliderWrappers); - return rubricWrapper; - } - private SliderWrapper createSliderWrapper(Slider slider, SliderStatistic sliderStatistic) { + protected SliderWrapper createSliderWrapper(String startLabel, String endLabel, SliderStatistic sliderStatistic) { String barChartName = createChartAndGetName(sliderStatistic); String tableName = createTableAndGetName(sliderStatistic); - return new SliderWrapper(slider, barChartName, tableName); + return new SliderWrapper(startLabel, endLabel, barChartName, tableName); } private String createChartAndGetName(SliderStatistic sliderStatistic) { @@ -117,6 +111,7 @@ public class RubricBarChartsController extends FormBasicController { columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(StatisticCols.term)); DefaultFlexiColumnModel valueColumn = new DefaultFlexiColumnModel(StatisticCols.value); valueColumn.setAlignment(FlexiColumnModel.ALIGNMENT_RIGHT); + valueColumn.setHeaderAlignment(FlexiColumnModel.ALIGNMENT_RIGHT); valueColumn.setFooterCellRenderer(new RubricAvgRenderer(rubric)); columnsModel.addFlexiColumnModel(valueColumn); @@ -153,80 +148,21 @@ public class RubricBarChartsController extends FormBasicController { } public final static class RubricWrapper { - - private final Rubric rubric; - private List<SliderWrapper> sliders; - - public RubricWrapper(Rubric rubric) { - this.rubric = rubric; - } - public static int getWidthInPercent(Rubric theRubric) { - if(theRubric.getSliderType() != SliderType.continuous) { - int steps = theRubric.getSteps(); - int stepInPercent = Math.round(100.0f / steps) - 1; - return stepInPercent; - } - return 0; - } + private Rubric rubric; + private List<SliderWrapper> sliders; - public int getStepInPercent() { - return getWidthInPercent(rubric); + public RubricWrapper() { } - - public boolean isStepLabels() { - if(rubric.getStepLabels() == null || rubric.getStepLabels().isEmpty()) { - return false; - } - - List<StepLabel> stepLabels = rubric.getStepLabels(); - for(StepLabel stepLabel:stepLabels) { - if(stepLabel != null && StringHelper.containsNonWhitespace(stepLabel.getLabel())) { - return true; - } - } - return false; - } - - public boolean isLeftLabels() { - List<Slider> rubricSliders = rubric.getSliders(); - if(rubricSliders != null && rubricSliders.size() > 0) { - for(Slider slider:rubricSliders) { - if(slider != null && StringHelper.containsNonWhitespace(slider.getStartLabel())) { - return true; - } - } - } - return false; - } - - public boolean isRightLabels() { - List<Slider> rubricSliders = rubric.getSliders(); - if(rubricSliders != null && rubricSliders.size() > 0) { - for(Slider slider:rubricSliders) { - if(slider != null && StringHelper.containsNonWhitespace(slider.getEndLabel())) { - return true; - } - } - } - return false; + + public RubricWrapper(Rubric rubric) { + this.rubric = rubric; } - public List<String> getStepLabels() { - if(rubric.getStepLabels() != null && rubric.getStepLabels().size() > 0) { - List<String> stepLabels = new ArrayList<>(rubric.getStepLabels().size()); - for(StepLabel stepLabel:rubric.getStepLabels()) { - stepLabels.add(stepLabel.getLabel()); - } - return stepLabels; - } - return new ArrayList<>(1); - } - public List<SliderWrapper> getSliders() { return sliders; } - + public void setSliders(List<SliderWrapper> sliders) { this.sliders = sliders; } @@ -244,42 +180,41 @@ public class RubricBarChartsController extends FormBasicController { return false; } } - - + public static final class SliderWrapper { - private final Slider slider; + private final String startLabel; + private final String endLabel; private final String chartName; private final String tableName; - SliderWrapper(Slider slider, String chartName, String tableName) { + SliderWrapper(String startLabel, String endLabel, String chartName, String tableName) { super(); - this.slider = slider; + this.startLabel = startLabel; + this.endLabel = endLabel; this.chartName = chartName; this.tableName = tableName; } public String getStartLabel() { - String start = slider.getStartLabel(); - return start == null ? "" : start; + return startLabel == null ? "" : startLabel; } public String getEndLabel() { - String end = slider.getEndLabel(); - return end == null ? "" : end; + return endLabel == null ? "" : endLabel; } - + public String getChartName() { return chartName; } - + public String getTableName() { return tableName; } } - - private final static class StatisticRow { - + + protected final static class StatisticRow { + private final String term; private final String value; @@ -297,8 +232,8 @@ public class RubricBarChartsController extends FormBasicController { return value; } } - - private final static class StatisticDataModel extends DefaultFlexiTableDataModel<StatisticRow> + + protected final static class StatisticDataModel extends DefaultFlexiTableDataModel<StatisticRow> implements FlexiTableFooterModel { private final String footerHeader; @@ -339,8 +274,8 @@ public class RubricBarChartsController extends FormBasicController { return col == 1? average: null; } } - - private enum StatisticCols implements FlexiColumnDef { + + protected enum StatisticCols implements FlexiColumnDef { term("rubric.report.figure.title"), value("rubric.report.value.title"); @@ -356,4 +291,4 @@ public class RubricBarChartsController extends FormBasicController { } } -} +} \ No newline at end of file diff --git a/src/main/java/org/olat/modules/forms/ui/RubricSlidersBarChartsController.java b/src/main/java/org/olat/modules/forms/ui/RubricSlidersBarChartsController.java new file mode 100644 index 00000000000..3206e805962 --- /dev/null +++ b/src/main/java/org/olat/modules/forms/ui/RubricSlidersBarChartsController.java @@ -0,0 +1,61 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.modules.forms.ui; + +import java.util.ArrayList; +import java.util.List; + +import org.olat.core.gui.UserRequest; +import org.olat.core.gui.control.WindowControl; +import org.olat.modules.forms.EvaluationFormSessionRef; +import org.olat.modules.forms.model.xml.Rubric; +import org.olat.modules.forms.model.xml.Slider; +import org.olat.modules.forms.ui.model.RubricStatistic; +import org.olat.modules.forms.ui.model.SliderStatistic; + +/** + * + * Initial date: 25.05.2018<br> + * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com + * + */ +public class RubricSlidersBarChartsController extends RubricBarChartsController { + + public RubricSlidersBarChartsController(UserRequest ureq, WindowControl wControl, Rubric rubric, + List<? extends EvaluationFormSessionRef> sessions) { + super(ureq, wControl, rubric, sessions); + initForm(ureq); + } + + @Override + protected RubricWrapper createRubricWrapper() { + RubricStatistic rubricStatistic = new RubricStatistic(getRubric(), getSessions()); + List<SliderWrapper> sliderWrappers = new ArrayList<>(); + for (Slider slider: getRubric().getSliders()) { + SliderStatistic sliderStatistic = rubricStatistic.getSliderStatistic(slider); + SliderWrapper sliderWrapper = createSliderWrapper(slider.getStartLabel(), slider.getEndLabel(), sliderStatistic); + sliderWrappers.add(sliderWrapper); + } + RubricWrapper rubricWrapper = new RubricWrapper(getRubric()); + rubricWrapper.setSliders(sliderWrappers); + return rubricWrapper; + } + +} diff --git a/src/main/java/org/olat/modules/forms/ui/RubricTotalBarChartsController.java b/src/main/java/org/olat/modules/forms/ui/RubricTotalBarChartsController.java new file mode 100644 index 00000000000..ebb6e298c75 --- /dev/null +++ b/src/main/java/org/olat/modules/forms/ui/RubricTotalBarChartsController.java @@ -0,0 +1,59 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.modules.forms.ui; + +import java.util.ArrayList; +import java.util.List; + +import org.olat.core.gui.UserRequest; +import org.olat.core.gui.control.WindowControl; +import org.olat.modules.forms.EvaluationFormSessionRef; +import org.olat.modules.forms.model.xml.Rubric; +import org.olat.modules.forms.ui.model.RubricStatistic; +import org.olat.modules.forms.ui.model.SliderStatistic; + +/** + * + * Initial date: 19.06.2018<br> + * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com + * + */ +public class RubricTotalBarChartsController extends RubricBarChartsController { + + public RubricTotalBarChartsController(UserRequest ureq, WindowControl wControl, Rubric rubric, + List<? extends EvaluationFormSessionRef> sessions) { + super(ureq, wControl, rubric, sessions); + initForm(ureq); + } + + @Override + protected RubricWrapper createRubricWrapper() { + String name = translate("rubric.report.total", new String[] {getRubric().getName()}); + RubricStatistic rubricStatistic = new RubricStatistic(getRubric(), getSessions()); + SliderStatistic totalStatistic = rubricStatistic.getTotalStatistic(); + List<SliderWrapper> sliderWrappers = new ArrayList<>(); + SliderWrapper sliderWrapper = createSliderWrapper(name, null, totalStatistic); + sliderWrappers.add(sliderWrapper); + RubricWrapper rubricWrapper = new RubricWrapper(getRubric()); + rubricWrapper.setSliders(sliderWrappers); + return rubricWrapper; + } + +} diff --git a/src/main/java/org/olat/modules/forms/ui/RubricsTotalController.java b/src/main/java/org/olat/modules/forms/ui/RubricsTotalController.java deleted file mode 100644 index 44994933eae..00000000000 --- a/src/main/java/org/olat/modules/forms/ui/RubricsTotalController.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ -package org.olat.modules.forms.ui; - -import java.util.ArrayList; -import java.util.List; - -import org.olat.core.gui.UserRequest; -import org.olat.core.gui.components.form.flexible.FormItemContainer; -import org.olat.core.gui.components.form.flexible.elements.FlexiTableElement; -import org.olat.core.gui.components.form.flexible.impl.FormBasicController; -import org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel; -import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel; -import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel; -import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory; -import org.olat.core.gui.control.Controller; -import org.olat.core.gui.control.WindowControl; -import org.olat.modules.forms.EvaluationFormSessionRef; -import org.olat.modules.forms.model.xml.AbstractElement; -import org.olat.modules.forms.model.xml.Form; -import org.olat.modules.forms.model.xml.Rubric; -import org.olat.modules.forms.model.xml.ScaleType; -import org.olat.modules.forms.ui.RubricsTotalDataModel.RubricsTotalCols; -import org.olat.modules.forms.ui.model.RubricStatistic; - -/** - * - * Initial date: 23.05.2018<br> - * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com - * - */ -public class RubricsTotalController extends FormBasicController { - - private final Form form; - private final List<? extends EvaluationFormSessionRef> sessions; - - private RubricsTotalDataModel dataModel; - private FlexiTableElement tableEl; - - public RubricsTotalController(UserRequest ureq, WindowControl wControl, Form form, - List<? extends EvaluationFormSessionRef> sessions) { - super(ureq, wControl, LAYOUT_HORIZONTAL); - this.form = form; - this.sessions = sessions; - initForm(ureq); - } - - @Override - protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { - FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel(); - columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RubricsTotalCols.name)); - DefaultFlexiColumnModel avgColumn = new DefaultFlexiColumnModel(RubricsTotalCols.avg); - avgColumn.setAlignment(FlexiColumnModel.ALIGNMENT_RIGHT); - columnsModel.addFlexiColumnModel(avgColumn); - columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RubricsTotalCols.scale)); - - dataModel = new RubricsTotalDataModel(columnsModel); - tableEl = uifactory.addTableElement(getWindowControl(), "total", dataModel, getTranslator(), formLayout); - tableEl.setCustomizeColumns(false); - tableEl.setNumOfRowsEnabled(false); - loadModel(); - } - - private void loadModel() { - List<RubricsTotalRow> rubricTotalRows = new ArrayList<>(); - for (AbstractElement element: form.getElements()) { - if (element instanceof Rubric) { - Rubric rubric = (Rubric) element; - RubricStatistic rubricStatistic = new RubricStatistic(rubric, sessions); - String name = translate("rubric.report.total", new String[] {rubric.getName()}); - Double avg = rubricStatistic.getTotalStatistic().getAvg(); - ScaleType scaleType = rubric.getScaleType(); - double minStep = scaleType.getStepValue(rubric.getSteps(), rubric.getStart()); - double maxStep = scaleType.getStepValue(rubric.getSteps(), rubric.getEnd()); - String scale = translate("rubric.report.scale", new String[] { String.valueOf(minStep), String.valueOf(maxStep)}); - RubricsTotalRow row = new RubricsTotalRow(name, avg, scale); - rubricTotalRows.add(row); - } - } - dataModel.setObjects(rubricTotalRows); - tableEl.reset(); - } - - @Override - protected void formOK(UserRequest ureq) { - // - } - - @Override - protected void doDispose() { - // - } - -} diff --git a/src/main/java/org/olat/modules/forms/ui/RubricsTotalDataModel.java b/src/main/java/org/olat/modules/forms/ui/RubricsTotalDataModel.java deleted file mode 100644 index e83d6cdf250..00000000000 --- a/src/main/java/org/olat/modules/forms/ui/RubricsTotalDataModel.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ -package org.olat.modules.forms.ui; - -import org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableDataModel; -import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnDef; -import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel; - -/** - * - * Initial date: 23.05.2018<br> - * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com - * - */ -public class RubricsTotalDataModel extends DefaultFlexiTableDataModel<RubricsTotalRow> { - - public RubricsTotalDataModel(FlexiTableColumnModel columnModel) { - super(columnModel); - } - - @Override - public Object getValueAt(int row, int col) { - RubricsTotalRow rubricsTotalRow = getObject(row); - switch (RubricsTotalCols.values()[col]) { - case name: return rubricsTotalRow.getName(); - case avg: return EvaluationFormFormatter.formatDouble(rubricsTotalRow.getAverage()); - case scale: return rubricsTotalRow.getScale(); - default: return null; - } - } - - @Override - public DefaultFlexiTableDataModel<RubricsTotalRow> createCopyWithEmptyList() { - return new RubricsTotalDataModel(getTableColumnModel()); - } - - public enum RubricsTotalCols implements FlexiColumnDef { - name("rubric.report.name.title"), - avg("rubric.report.avg.title"), - scale("rubric.report.scale.title"); - - private final String i18nKey; - - private RubricsTotalCols(String i18nKey) { - this.i18nKey = i18nKey; - } - - @Override - public String i18nHeaderKey() { - return i18nKey; - } - } - -} diff --git a/src/main/java/org/olat/modules/forms/ui/RubricsTotalRow.java b/src/main/java/org/olat/modules/forms/ui/RubricsTotalRow.java deleted file mode 100644 index 7d31fb35db7..00000000000 --- a/src/main/java/org/olat/modules/forms/ui/RubricsTotalRow.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ -package org.olat.modules.forms.ui; - -/** - * - * Initial date: 23.05.2018<br> - * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com - * - */ -public class RubricsTotalRow { - - private final String name; - private final Double average; - private final String scale; - - RubricsTotalRow(String name, Double average, String scale) { - super(); - this.name = name; - this.average = average; - this.scale = scale; - } - - String getName() { - return name; - - } - - Double getAverage() { - return average; - } - - String getScale() { - return scale; - } - -} diff --git a/src/main/java/org/olat/modules/forms/ui/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/modules/forms/ui/_i18n/LocalStrings_de.properties index 30535844179..6177e4f4ef5 100644 --- a/src/main/java/org/olat/modules/forms/ui/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/modules/forms/ui/_i18n/LocalStrings_de.properties @@ -100,8 +100,6 @@ rubric.report.median.title=Median rubric.report.name.title= rubric.report.number.no.responses.title="$\:no.response" rubric.report.number.responses.title=Antworten -rubric.report.scale={0} bis {1} -rubric.report.scale.title=Skala rubric.report.sdtdev.title=Standardabweichung rubric.report.start.label.title= rubric.report.total=Gesamttotal {0} diff --git a/src/main/java/org/olat/modules/forms/ui/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/modules/forms/ui/_i18n/LocalStrings_en.properties index 1eed9e5004b..39ec32d9bca 100644 --- a/src/main/java/org/olat/modules/forms/ui/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/modules/forms/ui/_i18n/LocalStrings_en.properties @@ -105,8 +105,6 @@ rubric.report.median.title=Median rubric.report.name.title= rubric.report.number.no.responses.title="$\:no.response" rubric.report.number.responses.title=Answers -rubric.report.scale={0} to {1} -rubric.report.scale.title=Scale rubric.report.sdtdev.title=Standard deviation rubric.report.start.label.title= rubric.report.total=Total {0} -- GitLab