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

OO-4206: Score as trigger for fully assessed

parent b55a865b
No related branches found
No related tags found
No related merge requests found
......@@ -58,12 +58,15 @@ public class LearningPathNodeConfigController extends FormBasicController {
public static final String CONFIG_VALUE_TRIGGER_NODE_VISITED = "nodeVisited";
public static final String CONFIG_VALUE_TRIGGER_CONFIRMED = "confirmed";
public static final String CONFIG_VALUE_TRIGGER_STATUS_DONE = "statusDone";
public static final String CONFIG_VALUE_TRIGGER_SCORE = "score";
public static final String CONFIG_VALUE_TRIGGER_PASSED = "passed";
public static final String CONFIG_DEFAULT_TRIGGER = CONFIG_VALUE_TRIGGER_NONE;
public static final String CONFIG_KEY_SCORE_CUT_VALUE = "scoreCutValue";
private TextElement durationEl;
private SingleSelection obligationEl;
private SingleSelection triggerEl;
private TextElement scoreCutEl;
private final CourseConfig courseConfig;
private final ModuleConfiguration moduleConfigs;
......@@ -102,6 +105,10 @@ public class LearningPathNodeConfigController extends FormBasicController {
triggerEl.select(triggerKey, true);
}
String score = moduleConfigs.getStringValue(CONFIG_KEY_SCORE_CUT_VALUE);
scoreCutEl = uifactory.addTextElement("config.score.cut", 100, score, formLayout);
scoreCutEl.setMandatory(true);
uifactory.addFormSubmitButton("save", formLayout);
updateUI();
......@@ -116,6 +123,9 @@ public class LearningPathNodeConfigController extends FormBasicController {
if (ctrlConfig.isTriggerConfirmed()) {
triggerKV.add(entry(CONFIG_VALUE_TRIGGER_CONFIRMED, translate("config.trigger.confirmed")));
}
if (ctrlConfig.isTriggerScore()) {
triggerKV.add(entry(CONFIG_VALUE_TRIGGER_SCORE, translate("config.trigger.score")));
}
if (ctrlConfig.isTriggerPassed()) {
triggerKV.add(entry(CONFIG_VALUE_TRIGGER_PASSED, translate("config.trigger.passed")));
}
......@@ -135,12 +145,17 @@ public class LearningPathNodeConfigController extends FormBasicController {
private void updateUI() {
durationEl.setMandatory(isDurationMandatory());
boolean triggerScore = triggerEl.isOneSelected() && triggerEl.getSelectedKey().equals(CONFIG_VALUE_TRIGGER_SCORE);
scoreCutEl.setVisible(triggerScore);
}
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == obligationEl) {
updateUI();
} else if (source == triggerEl) {
updateUI();
}
super.formInnerEvent(ureq, source, event);
}
......@@ -150,6 +165,7 @@ public class LearningPathNodeConfigController extends FormBasicController {
boolean allOk = true;
allOk = validateInteger(durationEl, 1, 10000, isDurationMandatory(), "error.positiv.int");
allOk = validateInteger(scoreCutEl, 0, 10000, true, "error.positiv.int");
return allOk & super.validateFormLogic(ureq);
}
......@@ -195,6 +211,13 @@ public class LearningPathNodeConfigController extends FormBasicController {
: CONFIG_DEFAULT_TRIGGER;
moduleConfigs.setStringValue(CONFIG_KEY_TRIGGER, trigger);
if (scoreCutEl.isVisible()) {
String scoreCut = scoreCutEl.getValue();
moduleConfigs.setStringValue(CONFIG_KEY_SCORE_CUT_VALUE, scoreCut);
} else {
moduleConfigs.remove(CONFIG_KEY_SCORE_CUT_VALUE);
}
fireEvent(ureq, Event.DONE_EVENT);
}
......@@ -215,6 +238,8 @@ public class LearningPathNodeConfigController extends FormBasicController {
public boolean isTriggerConfirmed();
public boolean isTriggerScore();
public boolean isTriggerPassed();
public TranslateableBoolean getTriggerStatusDone();
......@@ -229,6 +254,7 @@ public class LearningPathNodeConfigController extends FormBasicController {
private boolean triggerNodeVisited;
private boolean triggerConfirmed;
private boolean triggerScore;
private boolean triggerPassed;
private TranslateableBoolean triggerStatusDone;
......@@ -245,6 +271,11 @@ public class LearningPathNodeConfigController extends FormBasicController {
return this;
}
public ControllerConfigBuilder enableScore() {
triggerScore = true;
return this;
}
public ControllerConfigBuilder enablePassed() {
triggerPassed = true;
return this;
......@@ -268,12 +299,14 @@ public class LearningPathNodeConfigController extends FormBasicController {
public final boolean triggerNodeVisited;
public final boolean triggerConfirmed;
public final boolean triggerScore;
public final boolean triggerPassed;
public final TranslateableBoolean triggerStatusDone;
public ControllerConfigImpl(ControllerConfigBuilder builder) {
this.triggerNodeVisited = builder.triggerNodeVisited;
this.triggerConfirmed = builder.triggerConfirmed;
this.triggerScore = builder.triggerScore;
this.triggerPassed = builder.triggerPassed;
this.triggerStatusDone = falseIfNull(builder.triggerStatusDone);
}
......@@ -294,6 +327,11 @@ public class LearningPathNodeConfigController extends FormBasicController {
return triggerConfirmed;
}
@Override
public boolean isTriggerScore() {
return triggerScore;
}
@Override
public boolean isTriggerPassed() {
return triggerPassed;
......
......@@ -4,10 +4,12 @@ config.duration=Zeitvorgabe (Minuten)
congig.obligation=Pflicht
config.obligation.mandatory=Obligatorisch
config.obligation.optional=Freiwillig
config.score.cut=Punkteminimum
config.trigger=Abschluss
config.trigger.confirmed=Best\u00E4tigt
config.trigger.none=Ohne Abschluss
config.trigger.passed=Bestanden
config.trigger.score=Punkte
config.trigger.status.done=Durchf\u00FChrung erledigt
config.trigger.visited=Kursbaustein ge\u00F6ffnet
error.fully.assessed.passed=Der Abschluss des Kurselementes kann nicht auf "erledigt" gesetzt sein, wenn im Kursbaustein nicht erledigt werden kann.
......
......@@ -4,10 +4,12 @@ config.duration=Estimated duration (minutes)
config.obligation=Obligation
config.obligation.mandatory=Mandatory
config.obligation.optional=Optional
config.score.cut=Minimal score
config.trigger=Completion
config.trigger.confirmed=Confirmed
config.trigger.none=No completion
config.trigger.passed=Passed
config.trigger.score=Score
config.trigger.status.done=Run done
config.trigger.visited=Course element visited
error.fully.assessed.passed=The completion of the course element can't be set to "passed", if the course element can't be passed.
......
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