Fixed 500 response from controller when we are not entered data in defaultShoppingListItems;
@@ -119,10 +119,11 @@ public class HabitAssignServiceImpl implements HabitAssignService {
habitAssign = buildHabitAssign(habit, user);
}
enhanceAssignWithCustomProperties(habitAssign, habitAssignPropertiesDto);
-
+ if (!habitAssignPropertiesDto.getDefaultShoppingListItems().isEmpty()) {
List<ShoppingListItem> shoppingList = shoppingListItemRepo.getShoppingListByListOfId(habitAssignPropertiesDto
.getDefaultShoppingListItems());
saveUserShoppingListItems(shoppingList, habitAssign);
+ }
return modelMapper.map(habitAssign, HabitAssignManagementDto.class);
}
