use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.
the class STCourseNode method getScoreCalculator.
/**
* @return Returns the scoreCalculator.
*/
@Override
public ScoreCalculator getScoreCalculator() {
if (scoreCalculator == null) {
scoreCalculator = new ScoreCalculator();
scoreCalculator.setFailedType(FailedEvaluationType.failedAsNotPassedAfterEndDate);
}
passedExpression = new Condition();
passedExpression.setConditionId("passed");
if (scoreCalculator.getPassedExpression() != null) {
passedExpression.setConditionExpression(scoreCalculator.getPassedExpression());
passedExpression.setExpertMode(true);
}
scoreExpression = new Condition();
scoreExpression.setConditionId("score");
if (scoreCalculator.getScoreExpression() != null) {
scoreExpression.setConditionExpression(scoreCalculator.getScoreExpression());
scoreExpression.setExpertMode(true);
}
failedExpression = new Condition();
failedExpression.setConditionId("failed");
if (scoreCalculator.getFailedExpression() != null) {
failedExpression.setConditionExpression(scoreCalculator.getFailedExpression());
failedExpression.setExpertMode(true);
}
return scoreCalculator;
}
use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.
the class InfoCourseNode method getPreConditionEdit.
/**
* Default set the write privileges to coaches and admin only
* @return
*/
public Condition getPreConditionEdit() {
if (preConditionEdit == null) {
preConditionEdit = new Condition();
preConditionEdit.setEasyModeCoachesAndAdmins(true);
preConditionEdit.setConditionExpression(preConditionEdit.getConditionFromEasyModeConfiguration());
preConditionEdit.setExpertMode(false);
}
preConditionEdit.setConditionId(EDIT_CONDITION_ID);
return preConditionEdit;
}
use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.
the class CalCourseNode method updateModuleConfigDefaults.
@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
ModuleConfiguration config = getModuleConfiguration();
if (isNewNode) {
// use defaults for new course building blocks
config.setBooleanEntry(NodeEditController.CONFIG_STARTPAGE, false);
config.setConfigurationVersion(1);
} else {
if (config.getConfigurationVersion() < 2) {
Condition cond = getPreConditionEdit();
if (!cond.isExpertMode() && cond.isEasyModeCoachesAndAdmins() && cond.getConditionExpression() == null) {
// ensure that the default config has a condition expression
cond.setConditionExpression(cond.getConditionFromEasyModeConfiguration());
}
config.setConfigurationVersion(2);
}
}
}
use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.
the class CalCourseNode method getPreConditionEdit.
/**
* Default set the write privileges to coaches and admin only
* @return
*/
public Condition getPreConditionEdit() {
if (preConditionEdit == null) {
preConditionEdit = new Condition();
preConditionEdit.setEasyModeCoachesAndAdmins(true);
preConditionEdit.setConditionExpression(preConditionEdit.getConditionFromEasyModeConfiguration());
preConditionEdit.setExpertMode(false);
}
preConditionEdit.setConditionId(EDIT_CONDITION_ID);
return preConditionEdit;
}
use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.
the class CalCourseNode method getConditionExpressions.
@Override
public List<ConditionExpression> getConditionExpressions() {
List<ConditionExpression> parentConditions = super.getConditionExpressions();
List<ConditionExpression> conditions = new ArrayList<>();
if (parentConditions != null && parentConditions.size() > 0) {
conditions.addAll(parentConditions);
}
Condition editCondition = getPreConditionEdit();
if (editCondition != null && StringHelper.containsNonWhitespace(editCondition.getConditionExpression())) {
ConditionExpression ce = new ConditionExpression(editCondition.getConditionId());
ce.setExpressionString(editCondition.getConditionExpression());
conditions.add(ce);
}
return conditions;
}
Aggregations