fixed a bug in the matching algoritm and supervisorAutoCompleteTests

This commit is contained in:
FredrikNorberg 2012-02-14 17:06:39 +01:00
parent 0a2ccd7d84
commit 907ffb5079
2 changed files with 11 additions and 6 deletions
src
main/java/se/su/dsv/scipro/match
test/java/se/su/dsv/scipro/match/dao

@ -107,10 +107,13 @@ public class GreedyMatchingAlgorithm implements MatchingAlgorithm {
logger.info("Not possible supervisor");
continue;
}
Match match = new Match(); // create a new match
match.setSupervisor(availability.getSupervisor());
match.setProjectIdea(projectIdea);
matchPair = new Pair(match, new Availability(null, 1L, 1, new ProjectClass()));
if(matchPair == null){
Match match = new Match(); // create a new match
match.setSupervisor(availability.getSupervisor());
match.setProjectIdea(projectIdea);
matchPair = new Pair(match, new Availability(null, 1L, 1, new ProjectClass()));
}
matchPair = getBestMatch(matchPair, availability);
}
@ -138,6 +141,8 @@ public class GreedyMatchingAlgorithm implements MatchingAlgorithm {
match.setSupervisor(availability.getSupervisor());
match = calculateScore(match);
System.out.println("new match points: "+match.getPoints());
System.out.println("old match points: " + oldMatch.getPoints());
if (match.getPoints() > oldMatch.getPoints()) {

@ -360,7 +360,7 @@ public class TestSupervisorDao {
supervisor3.getCapabilities().getLanguages().add(english);
List<Employee> result =
target.getAutoCompleteCapableSupervisors(bachelor, allLanguages,
target.getAutoCompleteCapableSupervisors(/*bachelor, allLanguages,*/
"Use", 6);
Assert.assertEquals(Arrays.asList(new Employee[] { supervisor1,
@ -381,7 +381,7 @@ public class TestSupervisorDao {
supervisor3.getCapabilities().getLanguages().add(english);
List<Employee> result =
target.getAutoCompleteCapableSupervisors(bachelor, allLanguages,
target.getAutoCompleteCapableSupervisors(/*bachelor, allLanguages,*/
"Use", 1);
Assert.assertEquals(Arrays.asList(new Employee[] { supervisor1 }),