67: Merge from develop
This commit is contained in:
commit
46173d5da3
core/src/main/java/se/su/dsv/scipro
view/src/main/java/se/su/dsv/scipro
@ -15,6 +15,8 @@ import se.su.dsv.scipro.checklist.ChecklistCategory;
|
|||||||
import se.su.dsv.scipro.file.FileUpload;
|
import se.su.dsv.scipro.file.FileUpload;
|
||||||
import se.su.dsv.scipro.match.*;
|
import se.su.dsv.scipro.match.*;
|
||||||
import se.su.dsv.scipro.match.ApplicationPeriod;
|
import se.su.dsv.scipro.match.ApplicationPeriod;
|
||||||
|
import se.su.dsv.scipro.match.Idea;
|
||||||
|
import se.su.dsv.scipro.match.IdeaService;
|
||||||
import se.su.dsv.scipro.match.Keyword;
|
import se.su.dsv.scipro.match.Keyword;
|
||||||
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;
|
||||||
@ -29,6 +31,7 @@ import se.su.dsv.scipro.reviewing.ReviewerAssignmentService;
|
|||||||
import se.su.dsv.scipro.reviewing.RoughDraftApprovalService;
|
import se.su.dsv.scipro.reviewing.RoughDraftApprovalService;
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
import se.su.dsv.scipro.system.*;
|
import se.su.dsv.scipro.system.*;
|
||||||
|
import se.su.dsv.scipro.util.Pair;
|
||||||
|
|
||||||
public class DataInitializer implements Lifecycle {
|
public class DataInitializer implements Lifecycle {
|
||||||
|
|
||||||
@ -44,10 +47,10 @@ public class DataInitializer implements Lifecycle {
|
|||||||
private PasswordService passwordService;
|
private PasswordService passwordService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private MilestoneActivityTemplateService milestoneActivityTemplateService;
|
private IdeaService ideaService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private IdeaService ideaService;
|
private MilestoneActivityTemplateService milestoneActivityTemplateService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private CurrentProfile profile;
|
private CurrentProfile profile;
|
||||||
@ -111,6 +114,7 @@ public class DataInitializer implements Lifecycle {
|
|||||||
createKeywordsIfNotDone();
|
createKeywordsIfNotDone();
|
||||||
createMilestonesIfNotDone();
|
createMilestonesIfNotDone();
|
||||||
createUsers();
|
createUsers();
|
||||||
|
createMatchedIdea();
|
||||||
createProjects();
|
createProjects();
|
||||||
createTarget();
|
createTarget();
|
||||||
createStudentIdea();
|
createStudentIdea();
|
||||||
@ -154,7 +158,7 @@ public class DataInitializer implements Lifecycle {
|
|||||||
applicationPeriod.setCourseStartDate(LocalDate.now().plusDays(APPLICATION_PERIOD_COURSE_START_PLUS_DAYS));
|
applicationPeriod.setCourseStartDate(LocalDate.now().plusDays(APPLICATION_PERIOD_COURSE_START_PLUS_DAYS));
|
||||||
applicationPeriod.setCourseStartTime(LocalTime.of(8, 0));
|
applicationPeriod.setCourseStartTime(LocalTime.of(8, 0));
|
||||||
applicationPeriod = save(applicationPeriod);
|
applicationPeriod = save(applicationPeriod);
|
||||||
applicationPeriod.setProjectTypes(new HashSet<>(Collections.singletonList(bachelorClass)));
|
applicationPeriod.setProjectTypes(new HashSet<>(Set.of(bachelorClass, masterClass)));
|
||||||
save(applicationPeriod);
|
save(applicationPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,6 +306,22 @@ public class DataInitializer implements Lifecycle {
|
|||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createMatchedIdea() {
|
||||||
|
Idea idea = new Idea();
|
||||||
|
idea.setApplicationPeriod(applicationPeriod);
|
||||||
|
idea.setType(Idea.Type.SUPERVISOR);
|
||||||
|
idea.setProjectType(masterClass);
|
||||||
|
idea.setTitle("Idea without first meeting");
|
||||||
|
idea.setDescription("Explore the deep sea");
|
||||||
|
idea.setPrerequisites("Diving experience");
|
||||||
|
idea.setResearchArea(researchArea1);
|
||||||
|
idea.setPublished(true);
|
||||||
|
Idea saved = ideaService.saveSupervisorIdea(idea, eve_employee, new ArrayList<>(Set.of(keyword1)), true);
|
||||||
|
Pair<Boolean, String> validated = ideaService.validateAdminAddAuthors(saved, Set.of(sid_student));
|
||||||
|
assert validated.getHead();
|
||||||
|
ideaService.setAuthors(saved, Set.of(sid_student), eve_employee);
|
||||||
|
}
|
||||||
|
|
||||||
private void createGradingCriterionTemplateIfNotDone() {
|
private void createGradingCriterionTemplateIfNotDone() {
|
||||||
save(getBachelorTemplate());
|
save(getBachelorTemplate());
|
||||||
save(getMasterTemplate());
|
save(getMasterTemplate());
|
||||||
|
@ -169,7 +169,11 @@ public class FirstMeetingPanel extends GenericPanel<Idea> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveAndNotify() {
|
private void saveAndNotify() {
|
||||||
firstMeetingRepository.save(getModelObject());
|
FirstMeeting saved = firstMeetingRepository.save(getModelObject());
|
||||||
|
// After saving the first meeting we have to populate it on the already loaded idea to
|
||||||
|
// make sure that other places that want to render the first meeting get the correct data.
|
||||||
|
// An alternative would be to detach the idea model to force a database refresh.
|
||||||
|
FirstMeetingPanel.this.getModelObject().setFirstMeeting(saved);
|
||||||
NotificationSource source = new NotificationSource();
|
NotificationSource source = new NotificationSource();
|
||||||
String date = dateService.format(getModelObject().getFirstMeetingDate(), DateStyle.DATETIME);
|
String date = dateService.format(getModelObject().getFirstMeetingDate(), DateStyle.DATETIME);
|
||||||
String room = getModelObject().getRoom();
|
String room = getModelObject().getRoom();
|
||||||
|
@ -337,29 +337,26 @@ public class SupervisorMyIdeasPanel extends Panel {
|
|||||||
if (idea.getMatch() == null) {
|
if (idea.getMatch() == null) {
|
||||||
return "-";
|
return "-";
|
||||||
}
|
}
|
||||||
switch (idea.getMatchStatus()) {
|
return switch (idea.getMatchStatus()) {
|
||||||
case UNMATCHED:
|
case UNMATCHED -> getString("status.unmatched");
|
||||||
return getString("status.unmatched");
|
case COMPLETED -> getString("status.completed");
|
||||||
case COMPLETED:
|
case INACTIVE -> getString("status.inactive");
|
||||||
return getString("status.completed");
|
case MATCHED -> {
|
||||||
case INACTIVE:
|
|
||||||
return getString("status.inactive");
|
|
||||||
case MATCHED:
|
|
||||||
if (applicationPeriodService.courseStartHasPassed(idea.getApplicationPeriod())) {
|
if (applicationPeriodService.courseStartHasPassed(idea.getApplicationPeriod())) {
|
||||||
if (idea.isExported()) {
|
if (idea.isExported()) {
|
||||||
if (idea.wasExportSuccessful()) {
|
if (idea.wasExportSuccessful()) {
|
||||||
return getString("status.project.created");
|
yield getString("status.project.created");
|
||||||
} else {
|
} else {
|
||||||
return getString("status.export.failed");
|
yield getString("status.export.failed");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return getString("status.awaiting.project.creation");
|
yield getString("status.awaiting.project.creation");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return getString("status.awaiting.course.start", Model.of(idea.getApplicationPeriod()));
|
yield getString("status.awaiting.course.start", Model.of(idea.getApplicationPeriod()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "-"; // can't happen
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user