Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>io.github.enkarin</groupId>
<artifactId>chef-bot</artifactId>
<version>2.8.4</version>
<version>2.8.5</version>
<name>Chef Bot</name>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;

import java.util.Optional;
import java.util.Set;

@Mapper(componentModel = MappingConstants.ComponentModel.SPRING)
Expand All @@ -20,6 +21,6 @@ public interface DishEntityModerationDtoMapper {
Set<String> productsToString(Set<ProductQuantity> products);

default String productToString(final ProductQuantity productQuantity) {
return productQuantity.getProduct().getProductName();
return productQuantity.getProduct().getProductName().concat(Optional.ofNullable(productQuantity.getQuantityProduct()).map(": "::concat).orElse(""));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -46,6 +47,15 @@ void createModerationRequest() {
assertThat(moderationRequestRepository.findAll()).hasSize(1).extracting(ModerationRequest::getModerationDish).extracting(Dish::getDishName).contains("newDish");
}

@Test
void createModerationRequestWithShowQuantityOfProduct() {
moderationRequestRepository.deleteAll();
dishService.initDishName(USER_ID, "newDish");
dishService.putAllDishFoodstuff(USER_ID, Map.of("Egg", "2", "Milk", "200 ml", "Salt", "2 gram"));

assertThat(moderationService.createModerationRequest(USER_ID).getProducts()).containsOnly("Egg: 2", "Milk: 200 ml", "Salt: 2 gram");
}

@Test
void addRequestMessages() {
final Set<ModerationRequestMessageDto> messageDtoSet = moderationRequestMessageRepository
Expand Down