Do not add duplicate supervisors in Daisy #26
@ -241,12 +241,12 @@ public class ProjectExporter extends AbstractWorker {
|
||||
}
|
||||
|
||||
private void updateHeadSupervisor(Project project) throws ExternalExportException {
|
||||
boolean add = true;
|
||||
boolean toAdd = true;
|
||||
Set<ProjectParticipant> contributors = daisyAPI.getContributors(project.getIdentifier());
|
||||
for (ProjectParticipant contributor : contributors) {
|
||||
if (contributor.getRole() == Role.SUPERVISOR) {
|
||||
if (contributor.getPerson().getId().equals(project.getHeadSupervisor().getIdentifier())) {
|
||||
add = false;
|
||||
toAdd = false;
|
||||
ansv7779 marked this conversation as resolved
Outdated
|
||||
} else {
|
||||
Response response = daisyAPI.deleteThesisPerson(project.getIdentifier(), contributor.getPerson().getId());
|
||||
if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {
|
||||
@ -260,12 +260,12 @@ public class ProjectExporter extends AbstractWorker {
|
||||
// the project from having multiple supervisors.
|
||||
// Hopefully Daisy API will soon have support for the function "change supervisor"
|
||||
// rather than just INSERT and DELETE rows in a table.
|
||||
add = false;
|
||||
toAdd = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (add) {
|
||||
if (toAdd) {
|
||||
externalExporter.addContributorToProject(project, project.getHeadSupervisor(), Role.SUPERVISOR);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user
I suggest, while we are still on it, rename the variable from "add" to "toAdd".