added GUI and logic for the setting
This commit is contained in:
parent
9793d08c84
commit
44039d68b2
src/main/java/se/su/dsv/scipro/admin/pages/match
@ -51,6 +51,9 @@
|
|||||||
</form>
|
</form>
|
||||||
<div wicket:id="container">
|
<div wicket:id="container">
|
||||||
<form wicket:id="suggestMatchesForm">
|
<form wicket:id="suggestMatchesForm">
|
||||||
|
<div wicket:id="forceAcceptInfoContainer" class="info-box rounded-box append-bottom prepend-top"><b><p>Force accepting of matches is activated</p></b><p>Suggesting matches
|
||||||
|
will automatically also force accept them without supervisors having the choice to decline to supervise
|
||||||
|
project ideas. You can change this option under Admin > System Settings</p></div>
|
||||||
<button wicket:id="suggestMatches">Suggest these matches to supervisors</button>
|
<button wicket:id="suggestMatches">Suggest these matches to supervisors</button>
|
||||||
<button wicket:id="suggestMatchesAtLeastOnePoints">Suggest matches with at least one points to
|
<button wicket:id="suggestMatchesAtLeastOnePoints">Suggest matches with at least one points to
|
||||||
supervisors
|
supervisors
|
||||||
|
@ -25,7 +25,9 @@ import org.apache.wicket.model.PropertyModel;
|
|||||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||||
|
|
||||||
import se.su.dsv.scipro.SciProSession;
|
import se.su.dsv.scipro.SciProSession;
|
||||||
|
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.WeightsDao;
|
import se.su.dsv.scipro.data.dao.interfaces.WeightsDao;
|
||||||
|
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
||||||
import se.su.dsv.scipro.match.Matcher;
|
import se.su.dsv.scipro.match.Matcher;
|
||||||
import se.su.dsv.scipro.match.Matcher.Result;
|
import se.su.dsv.scipro.match.Matcher.Result;
|
||||||
import se.su.dsv.scipro.match.Weights;
|
import se.su.dsv.scipro.match.Weights;
|
||||||
@ -42,6 +44,10 @@ public class AutomaticMatchPanel extends Panel {
|
|||||||
private MatchDao matchDao;
|
private MatchDao matchDao;
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private WeightsDao weightsDao;
|
private WeightsDao weightsDao;
|
||||||
|
@SpringBean
|
||||||
|
private GeneralSystemSettingsDao generalSystemSettingsDao;
|
||||||
|
|
||||||
|
private GeneralSystemSettings generalSystemSettings;
|
||||||
|
|
||||||
private Form<Void> suggestMatchesForm;
|
private Form<Void> suggestMatchesForm;
|
||||||
|
|
||||||
@ -51,6 +57,8 @@ public class AutomaticMatchPanel extends Panel {
|
|||||||
public AutomaticMatchPanel(String id) {
|
public AutomaticMatchPanel(String id) {
|
||||||
super(id);
|
super(id);
|
||||||
|
|
||||||
|
generalSystemSettings = generalSystemSettingsDao.getGeneralSystemSettingsInstance();
|
||||||
|
|
||||||
MatchingData matchingData = new MatchingData();
|
MatchingData matchingData = new MatchingData();
|
||||||
// matchingData.setWeights(new Weights());
|
// matchingData.setWeights(new Weights());
|
||||||
|
|
||||||
@ -87,6 +95,8 @@ public class AutomaticMatchPanel extends Panel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
add(new WebMarkupContainer("forceAcceptInfoContainer").setVisible(generalSystemSettings.isMatchAlgorithmMatchesAreForceAccepted()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
suggestMatchesForm.setOutputMarkupId(true);
|
suggestMatchesForm.setOutputMarkupId(true);
|
||||||
@ -128,7 +138,11 @@ public class AutomaticMatchPanel extends Panel {
|
|||||||
for (Match match : result1.matches) {
|
for (Match match : result1.matches) {
|
||||||
if(match.getPoints() >= points) {
|
if(match.getPoints() >= points) {
|
||||||
match.setCreatedBy(SciProSession.get().getUser());
|
match.setCreatedBy(SciProSession.get().getUser());
|
||||||
match.setStatus(Match.Status.PUBLISHED);
|
if (generalSystemSettings.isMatchAlgorithmMatchesAreForceAccepted()){
|
||||||
|
match.setStatus(Match.Status.CONFIRMED);
|
||||||
|
} else {
|
||||||
|
match.setStatus(Match.Status.PUBLISHED);
|
||||||
|
}
|
||||||
match = matchDao.save(match);
|
match = matchDao.save(match);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user