WIP: Assign supervisor to student ideas no matter if target (goal) is reached #96

Draft
tozh4728 wants to merge 5 commits from 67-supervisor-target-non-blocking into develop
4 changed files with 45 additions and 11 deletions

View File

@ -11,6 +11,7 @@ import java.util.*;
import se.su.dsv.scipro.checklist.ChecklistCategory;
import se.su.dsv.scipro.match.ApplicationPeriod;
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.MilestonePhaseTemplate;
import se.su.dsv.scipro.milestones.service.MilestoneActivityTemplateService;
@ -75,6 +76,7 @@ public class DataInitializer implements Lifecycle {
private ResearchArea researchArea2;
private ProjectType masterClass;
private ProjectType magisterClass;
private ApplicationPeriod applicationPeriod;
@Transactional
@Override
@ -89,6 +91,7 @@ public class DataInitializer implements Lifecycle {
createMilestonesIfNotDone();
createUsers();
createProjects();
createTarget();
}
if (profile.getCurrentProfile() == Profiles.DEV && noAdminUser()) {
createAdmin();
@ -103,7 +106,7 @@ public class DataInitializer implements Lifecycle {
}
private void createApplicationPeriodIfNotDone() {
ApplicationPeriod applicationPeriod = new ApplicationPeriod("HT 2014");
applicationPeriod = new ApplicationPeriod("HT 2014");
applicationPeriod.setStartDate(LocalDate.now().minusDays(APPLICATION_PERIOD_START_MINUS_DAYS));
applicationPeriod.setEndDate(LocalDate.now().plusDays(APPLICATION_PERIOD_END_PLUS_DAYS));
applicationPeriod.setCourseStartDate(LocalDate.now().plusDays(APPLICATION_PERIOD_COURSE_START_PLUS_DAYS));
@ -254,6 +257,12 @@ public class DataInitializer implements Lifecycle {
save(getMagisterTemplate());
}
private void createTarget() {
Target target = new Target(eric_employee, applicationPeriod, bachelorClass);
target.setTarget(10);
save(target);
}
private GradingReportTemplate getBachelorTemplate() {
GradingReportTemplate gradingReportTemplate = new GradingReportTemplate(
bachelorClass,

View File

@ -205,17 +205,35 @@ public abstract class AbstractAdminIdeaPanel extends Panel {
ideaService.adminUnmatchIdea(idea, SciProSession.get().getUser());
info("Unmatched idea: " + idea.getTitle());
} else {
if (
targetService.hasTargetsLeft(
ideaService.changeSupervisor(idea, newSelection, SciProSession.get().getUser());
Target currentTarget = targetService.findOne(
idea.getApplicationPeriod(),
newSelection,
idea.getProjectType()
)
) {
ideaService.changeSupervisor(idea, newSelection, SciProSession.get().getUser());
info("Supervisor changed");
);
Long countMatched = ideaService.countMatched(
idea.getApplicationPeriod(),
newSelection,
idea.getProjectType()
);
int targetCounter = (currentTarget == null) ? 0 : currentTarget.getTarget();
long matchedCounter = (countMatched == null) ? 0L : countMatched;
String msg =
"Supervisor changed: matched/target -> " +
matchedCounter +
" / " +
targetCounter +
" (" +
idea.getProjectType().getName() +
")";
if (matchedCounter > targetCounter) {
warn(msg);
} else {
error("The supervisor have reached current target numbers");
info(msg);
}
}
target.addListener(new AjaxFeedbackPanelUpdater());

View File

@ -129,6 +129,12 @@ footer a:hover { color: #d95e00;}
border-color: #EBCCD1;
}
.feedbackPanelWARNING {
color: #000000;
background-color: #FFD105;
border-color: #EBCCD1;
}
.feedbackPanelINFO {
color: #3C763D;
background-color: #DFF0D8;

View File

@ -9,6 +9,7 @@ spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.Ph
# We also need to set the implicit strategy to be JPA compliant, as we rely on this naming strategy for certain
# join tables (idea_Keyword vs idea_keyword)
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
spring.jpa.show-sql=false
spring.mvc.servlet.path=/api