Skip to content

Commit

Permalink
Fixed sub sector creation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
karthik-tarento committed Apr 24, 2024
1 parent 4a06ebd commit 0e10b7d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/main/java/org/sunbird/catalog/service/CatalogServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,16 @@ public SBApiResponse createSubSector(Map<String, Object> request) {
if (subSector.containsKey(Constants.IDENTIFIER)) {
continue;
} else {
for (Map<String, Object> existingSubSector : existingChildren) {
if (name.equalsIgnoreCase((String) existingSubSector.get(Constants.NAME))) {
errMsg = "Failed to create SubSector. Name '" + name + "' already exists in Sector.";
break;
} else {
requiredSubSector.add(name);
if (CollectionUtils.isEmpty(existingChildren)) {
requiredSubSector.add(name);
} else {
for (Map<String, Object> existingSubSector : existingChildren) {
if (name.equalsIgnoreCase((String) existingSubSector.get(Constants.NAME))) {
errMsg = "Failed to create SubSector. Name '" + name + "' already exists in Sector.";
break;
} else {
requiredSubSector.add(name);
}
}
}
}
Expand Down

0 comments on commit 0e10b7d

Please sign in to comment.