Allow a single author to write a thesis on both one-year master and master at the same time.

This commit is contained in:
Andreas Svanberg 2024-12-19 16:18:00 +01:00
parent 69949bc688
commit 4863763f04
2 changed files with 21 additions and 1 deletions
core/src/main/xsd
daisy-integration/src/main/java/se/su/dsv/scipro/io/impl

@ -75,6 +75,8 @@
<xs:sequence>
<xs:element name="level" type="educationalLevel" minOccurs="1">
</xs:element>
<xs:element name="courseCredits" type="xs:decimal" minOccurs="0">
</xs:element>
<xs:element name="department" type="serializableUnit" minOccurs="1">
</xs:element>
</xs:sequence>
@ -615,6 +617,8 @@
</xs:element>
<xs:element name="break" type="xs:boolean" minOccurs="1">
</xs:element>
<xs:element name="reparticipant" type="xs:boolean" minOccurs="1">
</xs:element>
<xs:element name="inactive" type="xs:boolean" minOccurs="1">
</xs:element>
<xs:element name="userName" type="xs:string" minOccurs="0">

@ -2,6 +2,7 @@ package se.su.dsv.scipro.io.impl;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
@ -82,7 +83,21 @@ public class ExternalExporterDaisyImpl implements ExternalExporter {
}
private EducationalLevel toDaisyLevel(Project project) {
return classMap.get(project.getProjectTypeDegreeType());
return switch (project.getProjectTypeDegreeType()) {
case NONE -> EducationalLevel.UNKNOWN;
case BACHELOR -> EducationalLevel.FIRST_CYCLE;
case MAGISTER -> EducationalLevel.SECOND_CYCLE;
case MASTER -> EducationalLevel.SECOND_CYCLE;
};
}
private static BigDecimal toDaisyCredits(Project project) {
return switch (project.getProjectTypeDegreeType()) {
case BACHELOR -> BigDecimal.valueOf(15);
case MAGISTER -> BigDecimal.valueOf(15);
case MASTER -> BigDecimal.valueOf(30);
case NONE -> null;
};
}
@Override
@ -95,6 +110,7 @@ public class ExternalExporterDaisyImpl implements ExternalExporter {
AddThesisAuthorCourse authorCourse = new AddThesisAuthorCourse();
authorCourse.setLevel(toDaisyLevel(project));
authorCourse.setDepartment(department);
authorCourse.setCourseCredits(toDaisyCredits(project));
AddThesisAuthor addThesisAuthor = new AddThesisAuthor();
addThesisAuthor.setCourse(authorCourse);