Skip to content
Snippets Groups Projects
Commit 2a0181cf authored by uhensler's avatar uhensler
Browse files

OO-4108: Respect scale direction when calculating min / max value

parent c29592a0
No related branches found
No related tags found
No related merge requests found
...@@ -194,12 +194,18 @@ public class MSServiceImpl implements MSService { ...@@ -194,12 +194,18 @@ public class MSServiceImpl implements MSService {
float rubricSumMin = evaluationFormManager.getRubricStatistic(rubric, getSlidersStatistic(rubric, true)) float rubricSumMin = evaluationFormManager.getRubricStatistic(rubric, getSlidersStatistic(rubric, true))
.getTotalStatistic() .getTotalStatistic()
.getSum().floatValue(); .getSum().floatValue();
// If no responses the min is 0
rubricSumMin = rubricSumMin > 0? 0: rubricSumMin;
sumMin += rubricSumMin;
float rubricSumMax = evaluationFormManager.getRubricStatistic(rubric, getSlidersStatistic(rubric, false)) float rubricSumMax = evaluationFormManager.getRubricStatistic(rubric, getSlidersStatistic(rubric, false))
.getTotalStatistic() .getTotalStatistic()
.getSum().floatValue(); .getSum().floatValue();
if (rubricSumMin > rubricSumMax) {
float temp = rubricSumMin;
rubricSumMin = rubricSumMax;
rubricSumMax = temp;
}
// If no responses the min is 0
rubricSumMin = rubricSumMin > 0? 0: rubricSumMin;
sumMin += rubricSumMin;
sumMax += rubricSumMax; sumMax += rubricSumMax;
} }
} }
...@@ -223,11 +229,17 @@ public class MSServiceImpl implements MSService { ...@@ -223,11 +229,17 @@ public class MSServiceImpl implements MSService {
float rubricAvgMin = evaluationFormManager.getRubricStatistic(rubric, getSlidersStatistic(rubric, true)) float rubricAvgMin = evaluationFormManager.getRubricStatistic(rubric, getSlidersStatistic(rubric, true))
.getTotalStatistic() .getTotalStatistic()
.getAvg().floatValue(); .getAvg().floatValue();
// If no responses the min is 0
rubricAvgMin = rubricAvgMin > 0? 0: rubricAvgMin;
float rubricAvgMax = evaluationFormManager.getRubricStatistic(rubric, getSlidersStatistic(rubric, false)) float rubricAvgMax = evaluationFormManager.getRubricStatistic(rubric, getSlidersStatistic(rubric, false))
.getTotalStatistic() .getTotalStatistic()
.getAvg().floatValue(); .getAvg().floatValue();
// switch if descending scale
if (rubricAvgMin > rubricAvgMax) {
float temp = rubricAvgMin;
rubricAvgMin = rubricAvgMax;
rubricAvgMax = temp;
}
// If no responses the min is 0
rubricAvgMin = rubricAvgMin > 0? 0: rubricAvgMin;
int numberOfSliders = rubric.getSliders().size(); int numberOfSliders = rubric.getSliders().size();
sumMin += numberOfSliders * rubricAvgMin; sumMin += numberOfSliders * rubricAvgMin;
sumMax += numberOfSliders * rubricAvgMax; sumMax += numberOfSliders * rubricAvgMax;
......
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