Allows admins to manage grading report templates #14
@ -20,6 +20,7 @@ import jakarta.inject.Provider;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.time.Month;
|
||||
import java.util.*;
|
||||
|
||||
public class DataInitializer implements Lifecycle {
|
||||
@ -232,19 +233,20 @@ public class DataInitializer implements Lifecycle {
|
||||
}
|
||||
|
||||
private void createGradingCriterionTemplateIfNotDone() {
|
||||
save(getBachelorTemplate(0));
|
||||
save(getBachelorTemplate(ProjectType.HP_15));
|
||||
save(getBachelorTemplate(ProjectType.HP_30));
|
||||
save(getMasterTemplate(0));
|
||||
save(getMasterTemplate(ProjectType.HP_15));
|
||||
save(getMasterTemplate(ProjectType.HP_30));
|
||||
save(getMagisterTemplate(0));
|
||||
save(getMagisterTemplate(ProjectType.HP_15));
|
||||
save(getMagisterTemplate(ProjectType.HP_30));
|
||||
save(getBachelorTemplate());
|
||||
save(getBachelorTemplate());
|
||||
save(getBachelorTemplate());
|
||||
save(getMasterTemplate());
|
||||
save(getMasterTemplate());
|
||||
save(getMasterTemplate());
|
||||
save(getMagisterTemplate());
|
||||
save(getMagisterTemplate());
|
||||
save(getMagisterTemplate());
|
||||
}
|
||||
|
||||
private GradingReportTemplate getBachelorTemplate(int credits) {
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(bachelorClass, credits);
|
||||
private GradingReportTemplate getBachelorTemplate() {
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(bachelorClass,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
|
||||
List<GradingCriterionPointTemplate> gradingCriterionPointTemplates = initPointTemplates();
|
||||
gradingCriterionPointTemplates.add(new GradingCriterionPointTemplate.Builder()
|
||||
@ -446,8 +448,9 @@ public class DataInitializer implements Lifecycle {
|
||||
return gradingReportTemplate;
|
||||
}
|
||||
|
||||
private GradingReportTemplate getMasterTemplate(int credits) {
|
||||
GradingReportTemplate gradingReportTemplateMaster = new GradingReportTemplate(masterClass, credits);
|
||||
private GradingReportTemplate getMasterTemplate() {
|
||||
GradingReportTemplate gradingReportTemplateMaster = new GradingReportTemplate(masterClass,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
|
||||
List<GradingCriterionPointTemplate> gradingCriterionPointTemplates = initPointTemplates();
|
||||
gradingCriterionPointTemplates.add(new GradingCriterionPointTemplate.Builder()
|
||||
@ -674,8 +677,9 @@ public class DataInitializer implements Lifecycle {
|
||||
return gradingReportTemplateMaster;
|
||||
}
|
||||
|
||||
private GradingReportTemplate getMagisterTemplate(int credits) {
|
||||
GradingReportTemplate gradingReportTemplateMagister = new GradingReportTemplate(magisterClass, credits);
|
||||
private GradingReportTemplate getMagisterTemplate() {
|
||||
GradingReportTemplate gradingReportTemplateMagister = new GradingReportTemplate(magisterClass,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
|
||||
List<GradingCriterionPointTemplate> gradingCriterionPointTemplates = initPointTemplates();
|
||||
gradingCriterionPointTemplates.add(new GradingCriterionPointTemplate.Builder()
|
||||
|
@ -7,6 +7,8 @@ import se.su.dsv.scipro.system.ProjectType;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -26,19 +28,20 @@ public class GradingReportTemplate extends DomainObject {
|
||||
@OneToMany(mappedBy = "gradingReportTemplate", cascade = {CascadeType.ALL})
|
||||
private Collection<GradingCriterionTemplate> criteria = new HashSet<>();
|
||||
|
||||
@Basic
|
||||
private int credits;
|
||||
@Temporal(TemporalType.DATE)
|
||||
@Column(name = "valid_from")
|
||||
private LocalDate validFrom;
|
||||
|
||||
protected GradingReportTemplate() {
|
||||
|
||||
}
|
||||
|
||||
public GradingReportTemplate(ProjectType projectType, int credits) {
|
||||
public GradingReportTemplate(ProjectType projectType, LocalDate validFrom) {
|
||||
if (projectType == null) {
|
||||
throw new IllegalArgumentException("ProjectType may not be null");
|
||||
}
|
||||
this.projectType = projectType;
|
||||
this.credits = credits;
|
||||
this.validFrom = validFrom;
|
||||
}
|
||||
|
||||
public SupervisorGradingReport createSupervisorReport(Project project, User student) {
|
||||
@ -93,6 +96,6 @@ public class GradingReportTemplate extends DomainObject {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GradingReportTemplate(id=" + this.id + ", projectType=" + this.projectType + ", credits=" + this.credits + ")";
|
||||
return "GradingReportTemplate(id=" + this.id + ", projectType=" + this.projectType + ", validFrom=" + this.validFrom + ")";
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package se.su.dsv.scipro.report;
|
||||
|
||||
import com.querydsl.jpa.JPAExpressions;
|
||||
import com.querydsl.jpa.JPQLQuery;
|
||||
import se.su.dsv.scipro.project.Project;
|
||||
import se.su.dsv.scipro.system.GenericRepo;
|
||||
|
||||
@ -7,6 +9,8 @@ import jakarta.inject.Inject;
|
||||
import jakarta.inject.Provider;
|
||||
import jakarta.persistence.EntityManager;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class GradingReportTemplateRepoImpl extends GenericRepo<GradingReportTemplate, Long> implements GradingReportTemplateRepo {
|
||||
@Inject
|
||||
public GradingReportTemplateRepoImpl(Provider<EntityManager> em) {
|
||||
@ -16,6 +20,12 @@ public class GradingReportTemplateRepoImpl extends GenericRepo<GradingReportTemp
|
||||
@Override
|
||||
public GradingReportTemplate getTemplate(Project project) {
|
||||
QGradingReportTemplate template = QGradingReportTemplate.gradingReportTemplate;
|
||||
return findOne(template.projectType.eq(project.getProjectType()).and(template.credits.eq(project.getCredits())));
|
||||
// find the latest template that is valid for the project
|
||||
JPQLQuery<LocalDate> validFrom = JPAExpressions
|
||||
.select(template.validFrom.max())
|
||||
.from(template)
|
||||
.where(template.projectType.eq(project.getProjectType())
|
||||
.and(template.validFrom.loe(project.getStartDate())));
|
||||
return findOne(template.projectType.eq(project.getProjectType()).and(template.validFrom.eq(validFrom)));
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
# For any given date there is only ever one valid template for a project type
|
||||
# That template is valid until the date a new template is valid from
|
||||
ALTER TABLE `grading_report_template`
|
||||
ADD COLUMN `valid_from` DATE NOT NULL DEFAULT '2001-01-01';
|
||||
|
||||
CREATE TEMPORARY TABLE pt_points
|
||||
(
|
||||
pt_id INT,
|
||||
credits INT,
|
||||
count INT
|
||||
);
|
||||
|
||||
# Count how many projects/credits each project type has
|
||||
INSERT INTO pt_points
|
||||
SELECT pt.id, credits, COUNT(*)
|
||||
FROM ProjectType pt
|
||||
INNER JOIN project p ON pt.id = p.projectType_id
|
||||
WHERE pt.id IN (SELECT projectType_id FROM grading_report_template)
|
||||
GROUP BY pt.id, credits;
|
||||
|
||||
CREATE TEMPORARY TABLE grading_templates_to_keep
|
||||
(
|
||||
id INT
|
||||
);
|
||||
|
||||
# Keep the most used grading template for each project type (based on projects/credits)
|
||||
INSERT INTO grading_templates_to_keep (id)
|
||||
SELECT t.id
|
||||
FROM grading_report_template t
|
||||
WHERE credits = (SELECT credits
|
||||
FROM pt_points m
|
||||
WHERE m.pt_id = t.projectType_id
|
||||
AND m.`count` = (SELECT MAX(count)
|
||||
FROM pt_points n
|
||||
WHERE n.pt_id = t.projectType_id));
|
||||
|
||||
DELETE FROM grading_criterion_point_template WHERE gradingCriterionTemplate_id IN (SELECT id FROM grading_criterion_template WHERE gradingReportTemplate_id NOT IN (SELECT id FROM grading_templates_to_keep));
|
||||
DELETE FROM grading_criterion_template WHERE gradingReportTemplate_id NOT IN (SELECT id FROM grading_templates_to_keep);
|
||||
DELETE FROM grading_report_template WHERE id NOT IN (SELECT id FROM grading_templates_to_keep);
|
||||
|
||||
DROP TABLE grading_templates_to_keep;
|
||||
DROP TABLE pt_points;
|
||||
|
||||
ALTER TABLE `grading_report_template`
|
||||
DROP COLUMN `credits`,
|
||||
ADD UNIQUE `UK_only_one_template_per_date_and_type` (`projectType_id`, `valid_from`);
|
@ -13,6 +13,7 @@ import se.su.dsv.scipro.test.IntegrationTest;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.Date;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
@ -52,7 +53,8 @@ public class FinalSeminarOppositionServiceImplIntegrationTest extends Integratio
|
||||
}
|
||||
|
||||
private GradingReportTemplate createGradingReportTemplate() {
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(projectType, 30);
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(projectType,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
return save(gradingReportTemplate);
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ import se.su.dsv.scipro.test.IntegrationTest;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -316,7 +317,8 @@ public class FinalSeminarServiceImplIntegrationTest extends IntegrationTest {
|
||||
}
|
||||
|
||||
private GradingReportTemplate createGradingReportTemplate(ProjectType projectType) {
|
||||
GradingReportTemplate template = new GradingReportTemplate(projectType, 30);
|
||||
GradingReportTemplate template = new GradingReportTemplate(projectType,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
return save(template);
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,8 @@ import se.su.dsv.scipro.test.InstanceProvider;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import java.lang.reflect.Field;
|
||||
import java.time.Clock;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.*;
|
||||
|
||||
@ -137,7 +139,8 @@ public class FinalSeminarServiceImplTest {
|
||||
|
||||
FinalSeminarOpposition finalSeminarOpposition = new FinalSeminarOpposition();
|
||||
DomainObjects.injectId(finalSeminarOpposition, 1L);
|
||||
finalSeminarOpposition.setOppositionReport(new OppositionReport(new GradingReportTemplate(new ProjectType(DegreeType.BACHELOR, "bachelor", "bachelor"), 1), finalSeminarOpposition));
|
||||
finalSeminarOpposition.setOppositionReport(new OppositionReport(new GradingReportTemplate(new ProjectType(DegreeType.BACHELOR, "bachelor", "bachelor"),
|
||||
LocalDate.of(2024, Month.JANUARY, 1)), finalSeminarOpposition));
|
||||
finalSeminar.setOppositions(Collections.singletonList(finalSeminarOpposition));
|
||||
|
||||
seminarService.delete(finalSeminar);
|
||||
|
@ -15,6 +15,7 @@ import se.su.dsv.scipro.util.Either;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
@ -251,7 +252,8 @@ public class GradingReportServiceImplIntegrationTest extends IntegrationTest {
|
||||
}
|
||||
|
||||
private GradingReportTemplate createGradingReportTemplate(ProjectType projectType) {
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(projectType, 30);
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(projectType,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
return save(gradingReportTemplate);
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import se.su.dsv.scipro.system.ProjectType;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -34,7 +35,7 @@ public class GradingReportTemplateTest {
|
||||
@Test
|
||||
public void creating_a_grading_report_template_with_null_project_type_should_fail() {
|
||||
assertThrows(IllegalArgumentException.class, () ->
|
||||
new GradingReportTemplate(null, 30));
|
||||
new GradingReportTemplate(null, LocalDate.of(2024, Month.JANUARY, 1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -100,6 +101,6 @@ public class GradingReportTemplateTest {
|
||||
}
|
||||
|
||||
private GradingReportTemplate createBachelorTemplate() {
|
||||
return new GradingReportTemplate(bachelor, 30);
|
||||
return new GradingReportTemplate(bachelor, LocalDate.of(2024, Month.JANUARY, 1));
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import se.su.dsv.scipro.test.DomainObjects;
|
||||
import se.su.dsv.scipro.test.ObjectMother;
|
||||
import se.su.dsv.scipro.test.UserBuilder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.*;
|
||||
|
||||
@ -49,7 +51,7 @@ public class OppositionReportServiceImplTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
GradingReportTemplate template = new GradingReportTemplate(BACHELOR, 30);
|
||||
GradingReportTemplate template = new GradingReportTemplate(BACHELOR, LocalDate.of(2024, Month.JANUARY, 1));
|
||||
List<GradingCriterionPointTemplate> gradingCriterionPointTemplates = new ArrayList<>();
|
||||
gradingCriterionPointTemplates.add(new GradingCriterionPointTemplate.Builder()
|
||||
.point(1)
|
||||
|
@ -6,6 +6,8 @@ import se.su.dsv.scipro.finalseminar.FinalSeminarOpposition;
|
||||
import se.su.dsv.scipro.system.DegreeType;
|
||||
import se.su.dsv.scipro.system.ProjectType;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -20,7 +22,8 @@ public class OppositionReportTest {
|
||||
public void prepareTemplate() {
|
||||
ProjectType bachelor = new ProjectType(DegreeType.BACHELOR, "bachelor", "bachelor");
|
||||
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(bachelor, 30);
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(bachelor,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
addCriteria(gradingReportTemplate);
|
||||
|
||||
oppositionReport = gradingReportTemplate.createOppositionReport(new FinalSeminarOpposition());
|
||||
|
@ -3,6 +3,8 @@ package se.su.dsv.scipro.report;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -16,7 +18,7 @@ public class SupervisorGradingReportFactoryTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
gradingReportTemplate = new GradingReportTemplate(BACHELOR, 30);
|
||||
gradingReportTemplate = new GradingReportTemplate(BACHELOR, LocalDate.of(2024, Month.JANUARY, 1));
|
||||
List<GradingCriterionPointTemplate> gradingCriterionPointTemplates = new ArrayList<>();
|
||||
gradingCriterionPointTemplates.add(new GradingCriterionPointTemplate.Builder()
|
||||
.point(1)
|
||||
|
@ -8,6 +8,7 @@ import se.su.dsv.scipro.system.ProjectType;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -25,7 +26,7 @@ public class SupervisorGradingReportTest {
|
||||
ProjectType bachelor = new ProjectType(DegreeType.BACHELOR, "bachelor", "bachelor");
|
||||
project = Project.builder().title("Foo").projectType(bachelor).startDate(LocalDate.now()).build();
|
||||
|
||||
gradingReportTemplate = new GradingReportTemplate(bachelor, 30);
|
||||
gradingReportTemplate = new GradingReportTemplate(bachelor, LocalDate.of(2024, Month.JANUARY, 1));
|
||||
addCriteria(gradingReportTemplate);
|
||||
|
||||
gradingReport = gradingReportTemplate.createSupervisorReport(project, new User());
|
||||
|
@ -6,6 +6,8 @@ import se.su.dsv.scipro.report.*;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
import se.su.dsv.scipro.test.ObjectMother;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -85,7 +87,8 @@ public class SupervisorBachelorGradeCalculatorTest extends GradeCalculatorTest {
|
||||
|
||||
@Override
|
||||
protected GradingReportTemplate prepareTemplate() {
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(ObjectMother.BACHELOR, 30);
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(ObjectMother.BACHELOR,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
|
||||
gradingReportTemplate.addProjectCriterion("U1 Sammanfattning", "U1 Abstract", 1, getPointTemplates(1));
|
||||
gradingReportTemplate.addProjectCriterion("U2 Introduktion", "U2 Introduction", 1, getPointTemplates(1));
|
||||
|
@ -6,6 +6,8 @@ import se.su.dsv.scipro.report.*;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
import se.su.dsv.scipro.test.ObjectMother;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -72,7 +74,8 @@ public class SupervisorMaster15GradeCalculatorTest extends GradeCalculatorTest {
|
||||
|
||||
@Override
|
||||
protected GradingReportTemplate prepareTemplate() {
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(ObjectMother.MASTER, 15);
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(ObjectMother.MASTER,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
|
||||
gradingReportTemplate.addProjectCriterion("U1 Sammanfattning", "U1 Abstract", 1, getPointTemplates(1));
|
||||
gradingReportTemplate.addProjectCriterion("U2 Introduktion", "U2 Introduction", 1, getPointTemplates(1));
|
||||
|
@ -6,6 +6,8 @@ import se.su.dsv.scipro.report.*;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
import se.su.dsv.scipro.test.ObjectMother;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -72,7 +74,8 @@ public class SupervisorMaster30GradeCalculatorTest extends GradeCalculatorTest {
|
||||
|
||||
@Override
|
||||
protected GradingReportTemplate prepareTemplate() {
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(ObjectMother.MASTER, 30);
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(ObjectMother.MASTER,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
|
||||
gradingReportTemplate.addProjectCriterion("U1 Sammanfattning", "U1 Abstract", 1, getPointTemplates(1));
|
||||
gradingReportTemplate.addProjectCriterion("U2 Introduktion", "U2 Introduction", 1, getPointTemplates(1));
|
||||
|
@ -18,6 +18,8 @@ import se.su.dsv.scipro.test.ObjectMother;
|
||||
import se.su.dsv.scipro.test.SeminarBuilder;
|
||||
import se.su.dsv.scipro.test.UserBuilder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.*;
|
||||
|
||||
@ -76,7 +78,8 @@ public class DownloadPdfReportPanelTest extends SciProTest {
|
||||
}
|
||||
|
||||
private void prepareReports() {
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(BACHELOR, 30);
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(BACHELOR,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
List<GradingCriterionPointTemplate> gradingCriterionPointTemplates = new ArrayList<>();
|
||||
gradingCriterionPointTemplates.add(new GradingCriterionPointTemplate.Builder()
|
||||
.point(0)
|
||||
|
@ -29,6 +29,7 @@ import se.su.dsv.scipro.test.UserBuilder;
|
||||
import se.su.dsv.scipro.util.PageParameterKeys;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.*;
|
||||
|
||||
@ -152,7 +153,8 @@ public class OppositionReportPageTest extends SciProTest {
|
||||
}
|
||||
|
||||
private GradingReportTemplate createTemplate(ProjectType bachelor) {
|
||||
GradingReportTemplate reportTemplate = new GradingReportTemplate(bachelor, 30);
|
||||
GradingReportTemplate reportTemplate = new GradingReportTemplate(bachelor,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
List<GradingCriterionPointTemplate> gradingCriterionPointTemplates = new ArrayList<>();
|
||||
gradingCriterionPointTemplates.add(new GradingCriterionPointTemplate.Builder()
|
||||
.point(1)
|
||||
|
@ -17,6 +17,7 @@ import se.su.dsv.scipro.system.User;
|
||||
import se.su.dsv.scipro.test.UserBuilder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.*;
|
||||
|
||||
import static se.su.dsv.scipro.grading.CriteriaPanel.*;
|
||||
@ -110,7 +111,8 @@ public class CriteriaPanelTest extends SciProTest {
|
||||
}
|
||||
|
||||
private void prepareReports() {
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(BACHELOR, 30);
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(BACHELOR,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
gradingReportTemplate.addIndividualCriterion("Projektkriterium", "Project criterion", 1, getPointTemplates(2));
|
||||
gradingReportTemplate.addIndividualCriterion("Individuellt kriterium", "Individual criterion", 0, getPointTemplates(2));
|
||||
gradingReport = gradingReportTemplate.createSupervisorReport(SOME_PROJECT, SOME_USER);
|
||||
|
@ -20,6 +20,7 @@ import se.su.dsv.scipro.system.User;
|
||||
import se.su.dsv.scipro.test.UserBuilder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@ -44,7 +45,8 @@ public class FillOutReportPanelTest extends SciProTest {
|
||||
User headSupervisorUser = new UserBuilder().create();
|
||||
Project project = Project.builder().title("title").projectType(projectType).startDate(LocalDate.now()).headSupervisor(headSupervisorUser).build();
|
||||
finalSeminar.setProject(project);
|
||||
GradingReportTemplate template = new GradingReportTemplate(projectType, 30);
|
||||
GradingReportTemplate template = new GradingReportTemplate(projectType,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
template.addProjectCriterion("U1", "U1", 1, getPointTemplates(1));
|
||||
FinalSeminarOpposition finalSeminarOpposition = new FinalSeminarOpposition();
|
||||
finalSeminarOpposition.setFinalSeminar(finalSeminar);
|
||||
|
@ -13,6 +13,7 @@ import se.su.dsv.scipro.system.User;
|
||||
import se.su.dsv.scipro.test.UserBuilder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -61,7 +62,8 @@ public class GradingReportPointsPanelTest extends SciProTest {
|
||||
}
|
||||
|
||||
private void prepareReports() {
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(BACHELOR, 30);
|
||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(BACHELOR,
|
||||
LocalDate.of(2024, Month.JANUARY, 1));
|
||||
gradingReportTemplate.addProjectCriterion("title", "titleEn", 0, getPointTemplates(2));
|
||||
gradingReport = gradingReportTemplate.createSupervisorReport(SOME_PROJECT, SOME_USER);
|
||||
for (GradingCriterion gradingCriterion : gradingReport.getGradingCriteria()) {
|
||||
|
@ -11,6 +11,7 @@ import se.su.dsv.scipro.system.DegreeType;
|
||||
import se.su.dsv.scipro.system.ProjectType;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.Date;
|
||||
|
||||
public class ThesisApprovedPanelTest extends SciProTest {
|
||||
@ -31,7 +32,8 @@ public class ThesisApprovedPanelTest extends SciProTest {
|
||||
ProjectType projectType = new ProjectType(ProjectType.MASTER, "Master", "Master");
|
||||
projectType.setId(1L);
|
||||
|
||||
Mockito.when(gradingReportService.getTemplate(SOME_PROJECT)).thenReturn(new GradingReportTemplate(projectType, 30));
|
||||
Mockito.when(gradingReportService.getTemplate(SOME_PROJECT)).thenReturn(new GradingReportTemplate(projectType,
|
||||
LocalDate.of(2024, Month.JANUARY, 1)));
|
||||
panel = tester.startComponentInPage(new ThesisApprovedPanel("panel", Model.of(SOME_PROJECT)));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user