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>
|
||||
<div wicket:id="container">
|
||||
<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="suggestMatchesAtLeastOnePoints">Suggest matches with at least one points to
|
||||
supervisors
|
||||
|
@ -25,7 +25,9 @@ import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
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.dataobjects.GeneralSystemSettings;
|
||||
import se.su.dsv.scipro.match.Matcher;
|
||||
import se.su.dsv.scipro.match.Matcher.Result;
|
||||
import se.su.dsv.scipro.match.Weights;
|
||||
@ -42,6 +44,10 @@ public class AutomaticMatchPanel extends Panel {
|
||||
private MatchDao matchDao;
|
||||
@SpringBean
|
||||
private WeightsDao weightsDao;
|
||||
@SpringBean
|
||||
private GeneralSystemSettingsDao generalSystemSettingsDao;
|
||||
|
||||
private GeneralSystemSettings generalSystemSettings;
|
||||
|
||||
private Form<Void> suggestMatchesForm;
|
||||
|
||||
@ -51,6 +57,8 @@ public class AutomaticMatchPanel extends Panel {
|
||||
public AutomaticMatchPanel(String id) {
|
||||
super(id);
|
||||
|
||||
generalSystemSettings = generalSystemSettingsDao.getGeneralSystemSettingsInstance();
|
||||
|
||||
MatchingData matchingData = new MatchingData();
|
||||
// matchingData.setWeights(new Weights());
|
||||
|
||||
@ -87,6 +95,8 @@ public class AutomaticMatchPanel extends Panel {
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
add(new WebMarkupContainer("forceAcceptInfoContainer").setVisible(generalSystemSettings.isMatchAlgorithmMatchesAreForceAccepted()));
|
||||
}
|
||||
};
|
||||
suggestMatchesForm.setOutputMarkupId(true);
|
||||
@ -128,7 +138,11 @@ public class AutomaticMatchPanel extends Panel {
|
||||
for (Match match : result1.matches) {
|
||||
if(match.getPoints() >= points) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user