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

View File

@ -205,17 +205,35 @@ public abstract class AbstractAdminIdeaPanel extends Panel {
ideaService.adminUnmatchIdea(idea, SciProSession.get().getUser()); ideaService.adminUnmatchIdea(idea, SciProSession.get().getUser());
info("Unmatched idea: " + idea.getTitle()); info("Unmatched idea: " + idea.getTitle());
} else { } else {
if ( ideaService.changeSupervisor(idea, newSelection, SciProSession.get().getUser());
targetService.hasTargetsLeft(
Target currentTarget = targetService.findOne(
idea.getApplicationPeriod(), idea.getApplicationPeriod(),
newSelection, newSelection,
idea.getProjectType() idea.getProjectType()
) );
) { Long countMatched = ideaService.countMatched(
ideaService.changeSupervisor(idea, newSelection, SciProSession.get().getUser()); idea.getApplicationPeriod(),
info("Supervisor changed"); 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 { } else {
error("The supervisor have reached current target numbers"); info(msg);
} }
} }
target.addListener(new AjaxFeedbackPanelUpdater()); target.addListener(new AjaxFeedbackPanelUpdater());

View File

@ -129,6 +129,12 @@ footer a:hover { color: #d95e00;}
border-color: #EBCCD1; border-color: #EBCCD1;
} }
.feedbackPanelWARNING {
color: #000000;
background-color: #FFD105;
border-color: #EBCCD1;
}
.feedbackPanelINFO { .feedbackPanelINFO {
color: #3C763D; color: #3C763D;
background-color: #DFF0D8; 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 # 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) # join tables (idea_Keyword vs idea_keyword)
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
spring.jpa.show-sql=false
spring.mvc.servlet.path=/api spring.mvc.servlet.path=/api