Skip to content
Snippets Groups Projects
Commit a9efa7f6 authored by srosse's avatar srosse
Browse files

Merge OpenOLAT 10.2 to OpenOLAT default branch with b31a98ae96711925ecc24929df28ddcb061ce96d

parents 665337bc ffc845db
No related branches found
No related tags found
No related merge requests found
...@@ -199,21 +199,17 @@ public class DENManager { ...@@ -199,21 +199,17 @@ public class DENManager {
//cancel enroll in calendar entry //cancel enroll in calendar entry
if(event.getParticipants() != null) { if(event.getParticipants() != null) {
int currLength = event.getParticipants().length; int currLength = event.getParticipants().length;
if (currLength > 1) { if (currLength > 0) {
//more than one are enrolled //more than one are enrolled
String[] partsNew = new String[currLength - 1]; //one to delete List<String> partsNew = new ArrayList<>(currLength); //one to delete
String[] partsOld = event.getParticipants(); String[] partsOld = event.getParticipants();
String identityName = identity.getName(); String identityName = identity.getName();
for (int i = 0, j = 0; i < partsOld.length; i++) { for (String partOld:partsOld) {
if ( !(partsOld[i].equals(identityName)) ) { if (!partOld.equals(identityName)) {
partsNew[j] = partsOld[i]; partsNew.add(partOld);
j++; //only increment if new entry was made
} }
} }
event.setParticipants(partsNew); event.setParticipants(partsNew.toArray(new String[partsNew.size()]));
} else if (currLength == 1) {
//only one is enrolled, only simple reset needed
event.setParticipants(new String[0]);
} }
//save calendar event //save calendar event
boolean successfullyDone = calManager.updateEventFrom(cal, event); boolean successfullyDone = calManager.updateEventFrom(cal, event);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment