When you tried to edit a grading template in "Project management" -> "Grading Templates" the criterion could be shown in an order not reflecting the sortOrder of the criterion. The reason was that we only got the arbitrary order depending on the insertion order in the database. Changed the Collection to a List, it is now an ArrayList. Also added @OrderBy("sortOrder ASC") to actually sort by the order of the criterion thus ensuring visual order is intact.
This commit is contained in:
parent
cfe61a9ed8
commit
0af4e538a1
@ -10,6 +10,7 @@ import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import jakarta.persistence.OrderBy;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.Temporal;
|
||||
import jakarta.persistence.TemporalType;
|
||||
@ -22,7 +23,6 @@ import se.su.dsv.scipro.system.User;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -62,7 +62,8 @@ public class GradingReportTemplate extends DomainObject {
|
||||
// JPA-mappings of other tables referencing to this table "grading_report_template"
|
||||
// ----------------------------------------------------------------------------------
|
||||
@OneToMany(mappedBy = "gradingReportTemplate", cascade = {CascadeType.ALL}, orphanRemoval = true)
|
||||
private Collection<GradingCriterionTemplate> criteria = new HashSet<>();
|
||||
@OrderBy("sortOrder ASC")
|
||||
private List<GradingCriterionTemplate> criteria = new ArrayList<>();
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "grading_report_template_id", referencedColumnName = "id")
|
||||
|
Loading…
x
Reference in New Issue
Block a user