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