Skip to content
Snippets Groups Projects

feat: assign value for structure sortValue when no filled

Merged Alicia.DeDiosFuente requested to merge adf-312-structure-sort-value into master
All threads resolved!
Files
2
@@ -30,7 +30,7 @@ public class PublicationTypeService extends AouResourceService<PublicationType>
return this.publicationTypeRepository.findByName(name);
}
public Optional<Integer> getMaxSortValueWithoutParent() {
public Optional<Integer> getMaxSortValue() {
return this.publicationTypeRepository.findMaxSortValue();
}
@@ -39,7 +39,7 @@ public class PublicationTypeService extends AouResourceService<PublicationType>
// Calculates a default sort value if no one is given
if (!this.itemRepository.existsById(item.getResId()) && item.getSortValue() == null) {
Optional<Integer> maxValueOpt = this.getMaxSortValueWithoutParent();
Optional<Integer> maxValueOpt = this.getMaxSortValue();
int newOrder = maxValueOpt.isPresent() ? maxValueOpt.get() + AouConstants.ORDER_INCREMENT : AouConstants.ORDER_INCREMENT;
item.setSortValue(newOrder);
}
Loading