Allows admins to manage grading report templates #14
@ -32,6 +32,14 @@ public class GradingReportTemplate extends DomainObject {
|
||||
@Column(name = "valid_from")
|
||||
private LocalDate validFrom;
|
||||
|
||||
@Basic
|
||||
@Column(name = "note")
|
||||
private String note;
|
||||
|
||||
@Basic
|
||||
@Column(name = "failing_grade")
|
||||
private String failingGrade;
|
||||
|
||||
protected GradingReportTemplate() {
|
||||
|
||||
}
|
||||
@ -92,6 +100,22 @@ public class GradingReportTemplate extends DomainObject {
|
||||
this.projectType = projectType;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public String getFailingGrade() {
|
||||
return failingGrade;
|
||||
}
|
||||
|
||||
public void setFailingGrade(String failingGrade) {
|
||||
this.failingGrade = failingGrade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -66,6 +66,8 @@ public class GradingReportTemplateRepoImpl extends GenericRepo<GradingReportTemp
|
||||
public GradingReportTemplate updateTemplate(long templateId, GradingReportTemplateUpdate update) {
|
||||
GradingReportTemplate gradingReportTemplate = findOne(templateId);
|
||||
gradingReportTemplate.setValidFrom(update.validFrom());
|
||||
gradingReportTemplate.setNote(update.note());
|
||||
gradingReportTemplate.setFailingGrade(update.failingGrade());
|
||||
|
||||
gradingReportTemplate.getCriteria().clear();
|
||||
for (var criteria : update.criteria()) {
|
||||
|
@ -0,0 +1,3 @@
|
||||
ALTER TABLE `grading_report_template`
|
||||
ADD COLUMN `note` TEXT,
|
||||
ADD COLUMN `failing_grade` VARCHAR(32);
|
@ -16,9 +16,9 @@ class EditingGradingTemplate implements Serializable {
|
||||
private GradeLimits gradeLimits;
|
||||
|
||||
EditingGradingTemplate(GradingReportTemplate template) {
|
||||
this.note = "";
|
||||
this.note = template.getNote();
|
||||
this.validFrom = template.getValidFrom();
|
||||
this.gradeLimits = new GradeLimits();
|
||||
this.gradeLimits = new GradeLimits(template);
|
||||
this.criteria = new ArrayList<>();
|
||||
for (var criteria : template.getCriteria()) {
|
||||
Criteria editingCriteria = new Criteria(criteria);
|
||||
|
@ -1,5 +1,7 @@
|
||||
package se.su.dsv.scipro.admin.pages.grading;
|
||||
|
||||
import se.su.dsv.scipro.report.GradingReportTemplate;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -8,8 +10,9 @@ class GradeLimits implements Serializable {
|
||||
private List<GradeLimit> gradeLimits;
|
||||
private String failingGrade;
|
||||
|
||||
GradeLimits() {
|
||||
GradeLimits(GradingReportTemplate template) {
|
||||
this.gradeLimits = new ArrayList<>();
|
||||
this.failingGrade = template.getFailingGrade();
|
||||
}
|
||||
|
||||
void addNewLimit() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user