Fix adding new criteria should add point requirements

When you added new criteria you only got to set the criterion title, type, flag and point but you had to manually add the requirements for the first criterion.

Now when you add a new criterion the new criterion will by default add the requirement for the points.

reverted a previous change in the for loop the correct condition was to check against 0, I accidently turned that to 1 in a previous commit. Also added a comment to try and explain what that condition checks for.
This commit is contained in:
Nico Athanassiadis 2024-11-19 10:13:14 +01:00
parent d0baa11d3b
commit 883ccfc26d

@ -80,7 +80,10 @@ class EditingGradingTemplate implements Serializable {
}
public void addCriteria() {
this.criteria.add(new Criteria());
Criteria newCriteria = new Criteria();
newCriteria.points.add(newCriteria.new Point());
this.criteria.add(newCriteria);
}
public String getProjectType() {
@ -123,7 +126,7 @@ class EditingGradingTemplate implements Serializable {
this.titleEn = criteria.getTitleEn();
this.pointsRequiredToPass = criteria.getPointsRequiredToPass();
for (var point : criteria.getGradingCriterionPointTemplates()) {
if (point.getPoint() == 1) continue;
if (point.getPoint() == 0) continue; // This is to hide zero point requirements that never have any text
Point editingPoint = new Point(point);
this.points.add(editingPoint);
}