Merge branch 'develop' of ssh://git.dsv.su.se/git/scipro/scipro into develop
This commit is contained in:
commit
3a01503527
src
main
java/se/su/dsv/scipro
admin/panels/match
AdminEditProjectIdeaPanel.htmlAdminEditProjectIdeaPanel.javaManualWatsonPanel.htmlManualWatsonPanel.javaMatchHistoryPanel.htmlMatchHistoryPanel.java
data/dataobjects
match
project/panels
webapp/css
test/java/se/su/dsv/scipro/match
@ -5,6 +5,8 @@
|
||||
<a href="#" wicket:id="actionLink">Actions</a>
|
||||
|
|
||||
<a href="#" wicket:id="watsonLink">Project idea details</a>
|
||||
|
|
||||
<a href="#" wicket:id="historyLink">Match history</a>
|
||||
<div class="prepend-top" wicket:id="mainPanel"></div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
|
@ -15,11 +15,8 @@ public class AdminEditProjectIdeaPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Panel watsonPanel;
|
||||
private Panel actionPanel;
|
||||
private Panel currentPanel;
|
||||
private AjaxFallbackLink<Void> watsonLink;
|
||||
private AjaxFallbackLink<Void> actionLink;
|
||||
private Panel watsonPanel, actionPanel, historyPanel, currentPanel;
|
||||
private AjaxFallbackLink<Void> watsonLink, actionLink, historyLink;
|
||||
|
||||
public AdminEditProjectIdeaPanel(String id, IModel<ProjectIdea> model, final Component feedbackPanel) {
|
||||
super(id, model);
|
||||
@ -29,10 +26,12 @@ public class AdminEditProjectIdeaPanel extends Panel {
|
||||
|
||||
watsonPanel = new ManualWatsonPanel("mainPanel", model, feedbackPanel);
|
||||
actionPanel = new ProjectIdeaActionPanel("mainPanel", model, feedbackPanel);
|
||||
historyPanel = new MatchHistoryPanel("mainPanel", model, feedbackPanel);
|
||||
currentPanel = actionPanel;
|
||||
currentPanel.setOutputMarkupId(true);
|
||||
watsonPanel.setOutputMarkupId(true);
|
||||
actionPanel.setOutputMarkupId(true);
|
||||
historyPanel.setOutputMarkupId(true);
|
||||
watsonLink = new AjaxFallbackLink<Void>("watsonLink") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -49,6 +48,7 @@ public class AdminEditProjectIdeaPanel extends Panel {
|
||||
if (target != null) {
|
||||
target.addComponent(currentPanel);
|
||||
target.addComponent(actionLink);
|
||||
target.addComponent(historyLink);
|
||||
target.addComponent(this);
|
||||
}
|
||||
}
|
||||
@ -73,6 +73,7 @@ public class AdminEditProjectIdeaPanel extends Panel {
|
||||
if (target != null) {
|
||||
target.addComponent(currentPanel);
|
||||
target.addComponent(watsonLink);
|
||||
target.addComponent(historyLink);
|
||||
target.addComponent(this);
|
||||
}
|
||||
}
|
||||
@ -80,6 +81,30 @@ public class AdminEditProjectIdeaPanel extends Panel {
|
||||
actionLink.setOutputMarkupId(true);
|
||||
add(actionLink);
|
||||
|
||||
historyLink = new AjaxFallbackLink<Void>("historyLink") {
|
||||
|
||||
private static final long serialVersionUID = -9010339024625408623L;
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return currentPanel != historyPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
currentPanel.replaceWith(historyPanel);
|
||||
currentPanel = historyPanel;
|
||||
if(target!=null){
|
||||
target.addComponent(currentPanel);
|
||||
target.addComponent(watsonLink);
|
||||
target.addComponent(actionLink);
|
||||
target.addComponent(this);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
historyLink.setOutputMarkupId(true);
|
||||
add(historyLink);
|
||||
add(currentPanel);
|
||||
} else {
|
||||
this.setVisible(false);
|
||||
|
@ -3,7 +3,7 @@
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<wicket:enclosure child="manual">
|
||||
<wicket:enclosure child="watson">
|
||||
<!--<div wicket:id="manual" class="append-bottom"></div>-->
|
||||
<div wicket:id="watson"></div>
|
||||
</wicket:enclosure>
|
||||
|
@ -17,7 +17,7 @@ public class ManualWatsonPanel extends Panel {
|
||||
public ManualWatsonPanel(String id, IModel<ProjectIdea> model, final Component feedBack) {
|
||||
super(id);
|
||||
if (model.getObject()!=null){
|
||||
add(new ManualMatchPanel("manual", new PropertyModel<Match>(model, "match"), feedBack, Match.Status.CONFIRMED));
|
||||
//add(new ManualMatchPanel("manual", new PropertyModel<Match>(model, "match"), feedBack, Match.Status.CONFIRMED));
|
||||
add(new WatsonInfoPanel("watson", model.getObject().getMatch().getProjectIdea()));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div>
|
||||
<table class="rounded-corner">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rounded-left-top">Date</th><th>Status</th><th>Supervisor</th><th>Rejected by</th><th class="rounded-right-top">Comment by supervisor</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr wicket:id="historyList">
|
||||
<td wicket:id="date"></td>
|
||||
<td wicket:id="status"></td>
|
||||
<td wicket:id="supervisor"></td>
|
||||
<td wicket:id="rejectedBy"></td>
|
||||
<td wicket:id="comment"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5" class="rounded-foot"> </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,50 @@
|
||||
package se.su.dsv.scipro.admin.panels.match;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.Component;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
|
||||
|
||||
public class MatchHistoryPanel extends Panel {
|
||||
|
||||
@SpringBean
|
||||
private MatchDao matchDao;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MatchHistoryPanel(String id, IModel<ProjectIdea> model, final Component feedBack) {
|
||||
super(id);
|
||||
if (model.getObject()!=null){
|
||||
ProjectIdea pi = model.getObject();
|
||||
List<Match> matchObjects = matchDao.getMatchHistory(pi);
|
||||
ListView<Match> historyList = new ListView<Match>("historyList", matchObjects) {
|
||||
|
||||
private static final long serialVersionUID = 5246932667444626581L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<Match> item) {
|
||||
Match match = item.getModelObject();
|
||||
String supervisorName = match.getSupervisor() != null ? match.getSupervisor().getNameAsString() : "";
|
||||
String rejectedByName = match.getRejectedBy() != null ? match.getRejectedBy().getFullName() : "";
|
||||
String comment = match.getCommentForAdmin() != null ? match.getCommentForAdmin() : "";
|
||||
item.add(new Label("date", match.getDateCreated().toString()));
|
||||
item.add(new Label("status", match.getStatus().toString()));
|
||||
item.add(new Label("supervisor", supervisorName));
|
||||
item.add(new Label("rejectedBy", rejectedByName));
|
||||
item.add(new Label("comment", comment));
|
||||
add(item);
|
||||
}
|
||||
};
|
||||
add(historyList);
|
||||
}
|
||||
}
|
||||
}
|
@ -69,6 +69,12 @@ public abstract class Role extends LazyDeletableDomainObject implements Comparab
|
||||
return str;
|
||||
}
|
||||
|
||||
public String getEmailAsString(){
|
||||
String str = "";
|
||||
if(user.getEmailAddress()!=null)
|
||||
str += user.getEmailAddress();
|
||||
return str;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
|
@ -82,9 +82,10 @@ public class GreedyMatchingAlgorithm implements MatchingAlgorithm {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(availability.getProjectClass().toString().equalsIgnoreCase(ProjectClass.BACHELOR) &&
|
||||
projectIdea.getProjectClass().toString().equalsIgnoreCase(ProjectClass.MASTER)) {
|
||||
logger.info("A bachelor supervisor cannot handle master ideas.");
|
||||
if(!availability.getProjectClass().toString().equals(
|
||||
projectIdea.getProjectClass().toString()) ) {
|
||||
//logger.info("A bachelor supervisor cannot handle master ideas.");
|
||||
logger.info("Supervisor availability level and project idea level aren't equal.");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class Availability implements Serializable {
|
||||
private Integer numCapable;
|
||||
private final Employee supervisor;
|
||||
|
||||
public Availability(final Employee supervisor,final Long numMatched,final Integer numCapable,final ProjectClass projectClass) {
|
||||
public Availability(final Employee supervisor, final Long numMatched, final Integer numCapable, final ProjectClass projectClass) {
|
||||
this.supervisor = supervisor;
|
||||
this.numMatched = numMatched;
|
||||
this.numCapable = numCapable;
|
||||
|
@ -12,7 +12,7 @@
|
||||
<th>Project level</th>
|
||||
<th>Title</th>
|
||||
<th>Author(s)</th>
|
||||
<th class="rounded-right-top">Status</th>
|
||||
<th class="rounded-right-top">Supervisor</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
@ -28,7 +28,7 @@
|
||||
<td wicket:id="level"></td>
|
||||
<td><a href="#" wicket:id="ideaLink"><span wicket:id="title"></span></a></td>
|
||||
<td wicket:id="authors"></td>
|
||||
<td wicket:id="status"></td>
|
||||
<td wicket:id="supervisor"></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
@ -16,6 +16,7 @@ import se.su.dsv.scipro.data.dataobjects.Student;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.AuthorDao;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.ProjectIdeaDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
|
||||
import se.su.dsv.scipro.match.dataprovider.ProjectIdeaByUserDataProvider;
|
||||
import se.su.dsv.scipro.project.pages.ProjectIdeaSubmissionPage;
|
||||
@ -79,7 +80,16 @@ public class MyProjectIdeasPanel extends Panel {
|
||||
item.add(new DateFormatter(DateFormatter.FORMAT.EXTENDED).createFormattedDateLabel("date", idea.getDateCreated()));
|
||||
item.add(new Label("level", idea.getProjectClass().getName()));
|
||||
item.add(new Label("authors", authorString));
|
||||
item.add(new Label("status", idea.getStatus()));
|
||||
|
||||
String supervisor = "";
|
||||
if(idea.getMatch().getSupervisor()!=null&&idea.getMatch().getStatus().equals(Match.Status.CONFIRMED))
|
||||
supervisor = idea.getMatch().getSupervisor().getNameAsString()+" ("+idea.getMatch().getSupervisor().getEmailAsString()+")";
|
||||
else if(idea.getMatch().getStatus().equals(Match.Status.REFUSED))
|
||||
supervisor = "Project idea refused, needs to be rewritten";
|
||||
else
|
||||
supervisor = "Supervisor allocation in progress";
|
||||
|
||||
item.add(new Label("supervisor", supervisor));
|
||||
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,7 @@ table.rounded-corner
|
||||
list-style-type: none;
|
||||
}
|
||||
.rounded-box ul li {
|
||||
background: url('../images/triangle-right.png') left center
|
||||
no-repeat;
|
||||
/* background: url('../images/triangle-right.png') left center no-repeat; */
|
||||
padding-left: 15px;
|
||||
|
||||
}
|
||||
|
@ -579,18 +579,19 @@ public class TestGreedyMatchingAlgorithm {
|
||||
* Tests: We now perform a third test "testDavidH_Has_Less_Total_Available_Slots", here we test that "henrikH" is found, because "davidH"
|
||||
* has less "total available" slots (8) compared to 9 for "henrikH" for project ideas (master + bachelor)
|
||||
* */
|
||||
public void testDavidH_Has_Less_Total_Available_Slots() {
|
||||
public void testDavidH_Has_Less_Available_Slots() {
|
||||
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
||||
List<Employee> supervisorList = new ArrayList<Employee>();
|
||||
Employee davidH = createEmployee("David", "Hallberg", languages);
|
||||
supervisorAvailability.add(new Availability(davidH, 0L, 4, bachelorProjectClass));
|
||||
supervisorAvailability.add(new Availability(davidH, 1L, 5, masterProjectClass));
|
||||
|
||||
Employee henrikH = createEmployee("Henrik", "Hansson", languages);
|
||||
supervisorAvailability.add(new Availability(henrikH, 1L, 5, bachelorProjectClass));
|
||||
supervisorAvailability.add(new Availability(henrikH, 0L, 5, masterProjectClass));
|
||||
supervisorAvailability.add(new Availability(henrikH, 0L, 4, bachelorProjectClass));
|
||||
//supervisorAvailability.add(new Availability(henrikH, 0L, 5, masterProjectClass));
|
||||
supervisorList.add(henrikH);
|
||||
|
||||
Employee davidH = createEmployee("David", "Hallberg", languages);
|
||||
supervisorAvailability.add(new Availability(davidH, 1L, 4, bachelorProjectClass));
|
||||
//supervisorAvailability.add(new Availability(davidH, 1L, 5, masterProjectClass));
|
||||
|
||||
ProjectIdea secondBachelorIdea = createProjectIdea(bachelorProjectClass, applicationPeriod);
|
||||
projectIdeaList.clear();
|
||||
projectIdeaList.add(secondBachelorIdea); // David Hallberg is preferred supervisor for this project idea
|
||||
@ -678,4 +679,34 @@ public class TestGreedyMatchingAlgorithm {
|
||||
assertTrue(result.matches.get(2).getProjectIdea().equals(masterIdea));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
/* Test 5
|
||||
* =============================================================================================
|
||||
* This test verifies that bachelor project ideas will never be matched with
|
||||
* a master level Availability object, as opposed to previous practice.
|
||||
* */
|
||||
public void testAvailabilityLevelMatching() {
|
||||
Employee davidH = createEmployee("David", "Hallberg", languages);
|
||||
supervisorAvailability.add(new Availability(davidH, 1L, 1, bachelorProjectClass));
|
||||
supervisorAvailability.add(new Availability(davidH, 0L, 1, masterProjectClass));
|
||||
|
||||
Employee henrikH = createEmployee("Henrik", "Hansson", languages);
|
||||
supervisorAvailability.add(new Availability(henrikH, 0L, 1, bachelorProjectClass));
|
||||
supervisorAvailability.add(new Availability(henrikH, 0L, 1, masterProjectClass));
|
||||
|
||||
ProjectIdea bachelorIdea = createProjectIdea(bachelorProjectClass, applicationPeriod);
|
||||
unmatchedProjectIdeas.add(bachelorIdea);
|
||||
|
||||
Keyword båtar = createKeyword(keywordTypeWord, "båtar", false);
|
||||
davidH.getKeywords().getAll().add(båtar);
|
||||
bachelorIdea.getKeywords().getAll().add(båtar);
|
||||
|
||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
assertTrue(result.matches.get(0).getSupervisor().equals(henrikH));
|
||||
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorIdea));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user