@Override
protected RuleResult executeEnrolmentInEnrolmentEvaluation(final ICurricularRule curricularRule,
final IDegreeModuleToEvaluate sourceDegreeModuleToEvaluate, final EnrolmentContext enrolmentContext) {
final Registration registration = enrolmentContext.getRegistration();
final MaximumNumberOfECTSInSpecialSeasonEvaluation rule = (MaximumNumberOfECTSInSpecialSeasonEvaluation) curricularRule;
final BigDecimal totalEcts = getTotalEcts(registration, enrolmentContext);
if (!rule.allowEcts(totalEcts)) {
// a person can not enroll it self if ects are exceeded (usually the students case)
if (enrolmentContext.isRegistrationFromResponsiblePerson()) {
return RuleResult.createFalse(sourceDegreeModuleToEvaluate.getDegreeModule(),
"curricularRules.ruleExecutors.EnrolmentInSpecialSeasonEvaluationExecutor.too.many.specialSeason.ects",
rule.getMaxEcts().toPlainString());
} else {
// otherwise add warning, but let enrolment continue
return RuleResult.createWarning(sourceDegreeModuleToEvaluate.getDegreeModule(),
"curricularRules.ruleExecutors.EnrolmentInSpecialSeasonEvaluationExecutor.too.many.specialSeason.ects",
rule.getMaxEcts().toPlainString());
}
}
return RuleResult.createTrue(sourceDegreeModuleToEvaluate.getDegreeModule());
}