calculateTotalAvailability should be done before sorting the list NOT after
This commit is contained in:
parent
7f134b25a1
commit
95308fc113
src
main/java/se/su/dsv/scipro/match
test/java/se/su/dsv/scipro/match
@ -39,8 +39,8 @@ public class GreedyMatchingAlgorithm implements MatchingAlgorithm {
|
|||||||
matchProjectIdeas(unmatchedProjectIdeas, supervisorAvailability, pairList);
|
matchProjectIdeas(unmatchedProjectIdeas, supervisorAvailability, pairList);
|
||||||
|
|
||||||
if(!pairList.isEmpty()) {
|
if(!pairList.isEmpty()) {
|
||||||
Collections.sort(pairList);
|
|
||||||
calculateTotalAvailability(pairList);
|
calculateTotalAvailability(pairList);
|
||||||
|
Collections.sort(pairList);
|
||||||
Pair foundPair = pairList.get(0);
|
Pair foundPair = pairList.get(0);
|
||||||
for(Availability availability : supervisorAvailability) {
|
for(Availability availability : supervisorAvailability) {
|
||||||
if(availability.getSupervisor().equals(foundPair.getMatch().getSupervisor()) &&
|
if(availability.getSupervisor().equals(foundPair.getMatch().getSupervisor()) &&
|
||||||
|
@ -636,7 +636,7 @@ public class TestGreedyMatchingAlgorithm {
|
|||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
@Rollback
|
@Rollback
|
||||||
/* three supervisors which are matched against three project ideas */
|
/* three supervisors are matched against three project ideas */
|
||||||
public void testIncreaseSlotForMasterSupervisor_v3() {
|
public void testIncreaseSlotForMasterSupervisor_v3() {
|
||||||
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
List<ProjectIdea> projectIdeaList = new ArrayList<ProjectIdea>();
|
||||||
List<Employee> supervisorList = new ArrayList<Employee>();
|
List<Employee> supervisorList = new ArrayList<Employee>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user