diff --git a/src/main/java/eu/dnetlib/uoamonitorservice/controllers/SectionController.java b/src/main/java/eu/dnetlib/uoamonitorservice/controllers/SectionController.java index 9828fa6..a3b8189 100644 --- a/src/main/java/eu/dnetlib/uoamonitorservice/controllers/SectionController.java +++ b/src/main/java/eu/dnetlib/uoamonitorservice/controllers/SectionController.java @@ -79,10 +79,10 @@ public class SectionController { // this section belongs in default profile and it is new or it is updated if(stakeholder.getDefaultId() == null) { if(sectionId == null) { - onSaveDefaultSection(sectionFull, topicId, categoryId, subcategoryId, stakeholder); + onSaveDefaultSection(section, topicId, categoryId, subcategoryId, stakeholder); } else { - onUpdateDefaultSection(sectionFull, stakeholder); + onUpdateDefaultSection(section, stakeholder); } } @@ -93,12 +93,12 @@ public class SectionController { sections = subCategory.getNumbers(); } - int existing_index = sections.indexOf(sectionFull.getId()); + int existing_index = sections.indexOf(section.getId()); if (existing_index == -1) { - if(index != null) { - sections.add(Integer.parseInt(index), sectionFull.getId()); + if(Integer.parseInt(index) != -1) { + sections.add(Integer.parseInt(index), section.getId()); } else { - sections.add(sectionFull.getId()); + sections.add(section.getId()); } subCategoryDAO.save(subCategory); log.debug("Section saved!");