Skip to content
Snippets Groups Projects
Commit 239056fe authored by srosse's avatar srosse
Browse files

OO-4277: don't show the congratulations if the participant fails

parent 488d7c44
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,7 @@ import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController;
import org.olat.core.id.Identity;
import org.olat.core.util.StringHelper;
import org.olat.core.util.prefs.Preferences;
import org.olat.course.assessment.AssessmentManager;
import org.olat.course.highscore.manager.HighScoreManager;
......@@ -185,6 +186,9 @@ public class HighScoreRunController extends FormBasicController{
allScores = highscoreDataModel.getScores();
boolean failed = (ownEntry != null && ownEntry.getPassed() != null && !ownEntry.getPassed().booleanValue());
flc.contextPut("failed", Boolean.valueOf(failed));
// init showConfig from user Prefs
doLoadShowConfig(ureq);
......@@ -197,7 +201,7 @@ public class HighScoreRunController extends FormBasicController{
*/
private void doLoadShowConfig(UserRequest ureq) {
// add as listener to form layout for later dispatchinf of gui prefs changes
this.flc.getFormItemComponent().addListener(this);
flc.getFormItemComponent().addListener(this);
// init showConfig from user prefs
Boolean showConfig = Boolean.TRUE;
if (ureq != null) {
......@@ -208,7 +212,7 @@ public class HighScoreRunController extends FormBasicController{
}
}
// expose initial value to velocity
this.flc.contextPut("showConfig", Boolean.valueOf(showConfig));
flc.contextPut("showConfig", showConfig);
}
private void doUpdateShowConfig(UserRequest ureq, boolean newValue) {
......@@ -223,7 +227,7 @@ public class HighScoreRunController extends FormBasicController{
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
VelocityContainer mainVC = this.flc.getFormItemComponent();
VelocityContainer mainVC = flc.getFormItemComponent();
mainVC.put("loadd3js", new StatisticsComponent("d3loader"));
if (viewHistogram) {
......@@ -234,7 +238,7 @@ public class HighScoreRunController extends FormBasicController{
scoreHistogramVC.contextPut("datas", BarSeries.datasToString(allScores));
//histogram marker for own position
scoreHistogramVC.contextPut("cutValue",
ownIdIndices.size() > 0 ? highScoreManager.calculateHistogramCutvalue(
!ownIdIndices.isEmpty() ? highScoreManager.calculateHistogramCutvalue(
allMembers.get(ownIdIndices.get(0)).getScore(), modifiedData.getClasswidth(),
modifiedData.getMin()) : -1000);
//classwidth to correctly display the histogram
......@@ -256,12 +260,12 @@ public class HighScoreRunController extends FormBasicController{
&& allPodium.get(1).size() <= maxPerson && allPodium.get(2).size() <= maxPerson;
for (int i = 0; i < localizer.length; i++) {
int sizePerPos = allPodium.get(i).size();
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder(64);
if (sizePerPos > 2){
int reduce = 0;
//create link if podium has more than 2 entries per rank, entries can be displayed as anonymous
if (allPodium.get(i).get(0).getIdentity().equals(ownIdentity)) {
sb.append(userManager.getUserDisplayName(ownIdentity));
sb.append(StringHelper.escapeHtml(userManager.getUserDisplayName(ownIdentity)));
++reduce;
}
......@@ -277,8 +281,8 @@ public class HighScoreRunController extends FormBasicController{
} else {
for (HighScoreTableEntry te : allPodium.get(i)) {
if (!anonymous || te.getIdentity().equals(ownIdentity)) {
sb.append(userManager.getUserDisplayName(te.getIdentity()));
sb.append("<br/>");
sb.append(StringHelper.escapeHtml(userManager.getUserDisplayName(te.getIdentity())));
sb.append("<br>");
}
}
}
......
......@@ -9,9 +9,11 @@
<div class="panel-body">
<div class="container-fluid o_highscore o_block_large_bottom">
<div class="row clearfix">
#if ($position)
#if ($position)
<div class="o_position o_block_bottom">
<h2>$r.translate("highscore.position.congratulation")</h2>
#if($r.isFalse($failed))
<h2>$r.translate("highscore.position.congratulation")</h2>
#end
$position
#if($relposition)
<span class="o_position_relative">
......@@ -38,7 +40,7 @@
<div class="o_score">$score1 $r.translate("graph.axis.points")</div>
#end
<div class="o_name">
#if ($first != "")$first<br />#end
#if ($first != "")$first<br>#end
#if ($r.available("link1"))
$r.render("link1")
#elseif ($further1)
......@@ -63,7 +65,7 @@
<div class="o_score">$score2 $r.translate("graph.axis.points")</div>
#end
<div class="o_name">
#if ($second != "")$second<br /> #end
#if ($second != "")$second<br>#end
#if ($r.available("link2"))
$r.render("link2")
#elseif ($further2)
......@@ -88,7 +90,7 @@
<div class="o_score">$score3 $r.translate("graph.axis.points")</div>
#end
<div class="o_name">
#if ($third != "")$third<br />#end
#if ($third != "")$third<br>#end
#if ($r.available("link3"))
$r.render("link3")
#elseif ($further3)
......@@ -118,12 +120,12 @@
</div>
</div>
</div>
<script>/* <![CDATA[ */
jQuery('#o_collapseHighscore').on('hide.bs.collapse', function () {
jQuery('#o_collapseHighscoreToggler').removeClass('o_icon_close_togglebox').addClass('o_icon_open_togglebox');
$r.backgroundCommand("hide")
}).on('show.bs.collapse', function () {
jQuery('#o_collapseHighscoreToggler').removeClass('o_icon_open_togglebox').addClass('o_icon_close_togglebox');
$r.backgroundCommand("show")
})
/* ]]> */</script>
\ No newline at end of file
<script>
jQuery('#o_collapseHighscore').on('hide.bs.collapse', function () {
jQuery('#o_collapseHighscoreToggler').removeClass('o_icon_close_togglebox').addClass('o_icon_open_togglebox');
$r.backgroundCommand("hide")
}).on('show.bs.collapse', function () {
jQuery('#o_collapseHighscoreToggler').removeClass('o_icon_open_togglebox').addClass('o_icon_close_togglebox');
$r.backgroundCommand("show")
})
</script>
\ No newline at end of file
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