algorithm wont match idea to supervisor who is the same user as any of the authors

This commit is contained in:
Fredrik Friis 2012-02-13 17:00:52 +09:00
parent 7efb676936
commit cc3cd71012

@ -11,6 +11,7 @@ import org.springframework.stereotype.Component;
import se.su.dsv.scipro.data.dataobjects.Employee;
import se.su.dsv.scipro.data.dataobjects.Language;
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
import se.su.dsv.scipro.data.dataobjects.Student;
import se.su.dsv.scipro.match.Matcher.Result;
import se.su.dsv.scipro.match.dataobject.Availability;
import se.su.dsv.scipro.match.dataobject.Keyword;
@ -162,13 +163,20 @@ public class GreedyMatchingAlgorithm implements MatchingAlgorithm {
/**
* Returns if it is possible for the supervisor to work with this project idea based on
* language and if the idea has previously been rejected by the supervisor
* language and if the idea has previously been rejected by the supervisor and if the
* supervisor is the same as any of the authors
* @param projectIdea the project idea
* @param supervisor the supervisor
* @return boolean
*/
private boolean isPossibleSupervisor(ProjectIdea projectIdea, Employee supervisor) {
return isCompatibleLanguage(projectIdea, supervisor) && isNotRejectedBySupervisor(projectIdea, supervisor);
boolean notSame = true;
for (Student s : projectIdea.getAuthors()){
if (s.getUser().equals(supervisor.getUser())){
notSame = false;
}
}
return isCompatibleLanguage(projectIdea, supervisor) && isNotRejectedBySupervisor(projectIdea, supervisor) && notSame;
}
/**