67: Create student idea to test setting supervisor target
This commit is contained in:
parent
37b4e76ad2
commit
32c066a1c5
@ -9,9 +9,7 @@ import java.time.LocalTime;
|
|||||||
import java.time.Month;
|
import java.time.Month;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import se.su.dsv.scipro.checklist.ChecklistCategory;
|
import se.su.dsv.scipro.checklist.ChecklistCategory;
|
||||||
import se.su.dsv.scipro.match.ApplicationPeriod;
|
import se.su.dsv.scipro.match.*;
|
||||||
import se.su.dsv.scipro.match.Keyword;
|
|
||||||
import se.su.dsv.scipro.match.Target;
|
|
||||||
import se.su.dsv.scipro.milestones.dataobjects.MilestoneActivityTemplate;
|
import se.su.dsv.scipro.milestones.dataobjects.MilestoneActivityTemplate;
|
||||||
import se.su.dsv.scipro.milestones.dataobjects.MilestonePhaseTemplate;
|
import se.su.dsv.scipro.milestones.dataobjects.MilestonePhaseTemplate;
|
||||||
import se.su.dsv.scipro.milestones.service.MilestoneActivityTemplateService;
|
import se.su.dsv.scipro.milestones.service.MilestoneActivityTemplateService;
|
||||||
@ -40,6 +38,9 @@ public class DataInitializer implements Lifecycle {
|
|||||||
@Inject
|
@Inject
|
||||||
private MilestoneActivityTemplateService milestoneActivityTemplateService;
|
private MilestoneActivityTemplateService milestoneActivityTemplateService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private IdeaService ideaService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private CurrentProfile profile;
|
private CurrentProfile profile;
|
||||||
|
|
||||||
@ -68,12 +69,16 @@ public class DataInitializer implements Lifecycle {
|
|||||||
private User stina_student;
|
private User stina_student;
|
||||||
private User sid_student;
|
private User sid_student;
|
||||||
private User simon_student;
|
private User simon_student;
|
||||||
private ProjectType bachelorClass;
|
private User sofia_student;
|
||||||
private Set<ResearchArea> researchAreas;
|
private Set<ResearchArea> researchAreas;
|
||||||
private Long researchAreaId = RESEARCH_AREA_ID;
|
private Long researchAreaId = RESEARCH_AREA_ID;
|
||||||
private Set<Language> languages = Set.of(Language.SWEDISH, Language.ENGLISH);
|
private Set<Language> languages = Set.of(Language.SWEDISH, Language.ENGLISH);
|
||||||
|
private Program program;
|
||||||
private ResearchArea researchArea1;
|
private ResearchArea researchArea1;
|
||||||
private ResearchArea researchArea2;
|
private ResearchArea researchArea2;
|
||||||
|
private Keyword keyword1;
|
||||||
|
private Keyword keyword2;
|
||||||
|
private ProjectType bachelorClass;
|
||||||
private ProjectType masterClass;
|
private ProjectType masterClass;
|
||||||
private ProjectType magisterClass;
|
private ProjectType magisterClass;
|
||||||
private ApplicationPeriod applicationPeriod;
|
private ApplicationPeriod applicationPeriod;
|
||||||
@ -84,6 +89,7 @@ public class DataInitializer implements Lifecycle {
|
|||||||
if (profile.getCurrentProfile() == Profiles.DEV && noUsers()) {
|
if (profile.getCurrentProfile() == Profiles.DEV && noUsers()) {
|
||||||
createDefaultProjectTypesIfNotDone();
|
createDefaultProjectTypesIfNotDone();
|
||||||
createDefaultChecklistCategoriesIfNotDone();
|
createDefaultChecklistCategoriesIfNotDone();
|
||||||
|
createProgram();
|
||||||
createApplicationPeriodIfNotDone();
|
createApplicationPeriodIfNotDone();
|
||||||
createGradingCriterionTemplateIfNotDone();
|
createGradingCriterionTemplateIfNotDone();
|
||||||
createResearchAreasForDemo();
|
createResearchAreasForDemo();
|
||||||
@ -92,6 +98,7 @@ public class DataInitializer implements Lifecycle {
|
|||||||
createUsers();
|
createUsers();
|
||||||
createProjects();
|
createProjects();
|
||||||
createTarget();
|
createTarget();
|
||||||
|
createStudentIdea();
|
||||||
}
|
}
|
||||||
if (profile.getCurrentProfile() == Profiles.DEV && noAdminUser()) {
|
if (profile.getCurrentProfile() == Profiles.DEV && noAdminUser()) {
|
||||||
createAdmin();
|
createAdmin();
|
||||||
@ -105,6 +112,15 @@ public class DataInitializer implements Lifecycle {
|
|||||||
return userService.findByUsername(ADMIN + MAIL) == null;
|
return userService.findByUsername(ADMIN + MAIL) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createProgram() {
|
||||||
|
program = new Program();
|
||||||
|
program.setCode("AppCompSci");
|
||||||
|
program.setName("Tillämpad Datavetenskap");
|
||||||
|
program.setExternalId(123);
|
||||||
|
program.setNameEn("Applied Computer Science");
|
||||||
|
program = save(program);
|
||||||
|
}
|
||||||
|
|
||||||
private void createApplicationPeriodIfNotDone() {
|
private void createApplicationPeriodIfNotDone() {
|
||||||
applicationPeriod = new ApplicationPeriod("HT 2014");
|
applicationPeriod = new ApplicationPeriod("HT 2014");
|
||||||
applicationPeriod.setStartDate(LocalDate.now().minusDays(APPLICATION_PERIOD_START_MINUS_DAYS));
|
applicationPeriod.setStartDate(LocalDate.now().minusDays(APPLICATION_PERIOD_START_MINUS_DAYS));
|
||||||
@ -117,15 +133,15 @@ public class DataInitializer implements Lifecycle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createKeywordsIfNotDone() {
|
private void createKeywordsIfNotDone() {
|
||||||
Keyword keyword1 = new Keyword("IT");
|
keyword1 = new Keyword("IT");
|
||||||
keyword1.addResearchArea(researchArea1);
|
keyword1.addResearchArea(researchArea1);
|
||||||
keyword1.addResearchArea(researchArea2);
|
keyword1.addResearchArea(researchArea2);
|
||||||
save(keyword1);
|
keyword1 = save(keyword1);
|
||||||
|
|
||||||
Keyword keyword2 = new Keyword("Computers");
|
keyword2 = new Keyword("Computers");
|
||||||
keyword2.addResearchArea(researchArea1);
|
keyword2.addResearchArea(researchArea1);
|
||||||
keyword2.addResearchArea(researchArea2);
|
keyword2.addResearchArea(researchArea2);
|
||||||
save(keyword2);
|
keyword2 = save(keyword2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createResearchAreasForDemo() {
|
private void createResearchAreasForDemo() {
|
||||||
@ -184,7 +200,7 @@ public class DataInitializer implements Lifecycle {
|
|||||||
// Used to test assign supervisor to student idea
|
// Used to test assign supervisor to student idea
|
||||||
// this student has a submitted idea, which has not assigned supervisor
|
// this student has a submitted idea, which has not assigned supervisor
|
||||||
// don't use this student for anything else
|
// don't use this student for anything else
|
||||||
createStudent("Sofia");
|
sofia_student = createStudent("Sofia");
|
||||||
}
|
}
|
||||||
|
|
||||||
private User createStudent(String firstName) {
|
private User createStudent(String firstName) {
|
||||||
@ -271,6 +287,26 @@ public class DataInitializer implements Lifecycle {
|
|||||||
save(target);
|
save(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createStudentIdea() {
|
||||||
|
Idea idea = new Idea();
|
||||||
|
idea.setTitle("Fundamental Math Concepts of AI");
|
||||||
|
idea.setType(Idea.Type.STUDENT);
|
||||||
|
|
||||||
|
TholanderBox box = new TholanderBox();
|
||||||
|
box.setLiterature("Math AI Literature");
|
||||||
|
box.setBackground("Math AI Background");
|
||||||
|
box.setProblem("Math AI Problem");
|
||||||
|
box.setMethod("Math AI Method");
|
||||||
|
box.setInterests("Math AI Interests");
|
||||||
|
idea.setTholanderBox(box);
|
||||||
|
|
||||||
|
idea.setProjectType(bachelorClass);
|
||||||
|
idea.setApplicationPeriod(applicationPeriod);
|
||||||
|
|
||||||
|
List<Keyword> keywords = List.of(keyword1, keyword2);
|
||||||
|
ideaService.saveStudentIdea(idea, sofia_student, program, new HashSet<User>(), keywords, true);
|
||||||
|
}
|
||||||
|
|
||||||
private GradingReportTemplate getBachelorTemplate() {
|
private GradingReportTemplate getBachelorTemplate() {
|
||||||
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(
|
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(
|
||||||
bachelorClass,
|
bachelorClass,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user