Skip to content

Commit

Permalink
update product name spacing when convertingToFhir
Browse files Browse the repository at this point in the history
  • Loading branch information
hilpitome committed Jul 29, 2024
1 parent c3abea5 commit 5b7da62
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.opensrp.repository.postgres.mapper.custom.CustomStockMetadataMapper;
import org.opensrp.search.StockSearchBean;
import org.opensrp.util.RepositoryUtil;
import org.opensrp.util.Utils;
import org.smartregister.converters.StockConverter;
import org.smartregister.domain.PhysicalLocation;
import org.smartregister.domain.ProductCatalogue;
Expand Down Expand Up @@ -453,8 +454,12 @@ public List<StockAndProductDetails> getInventoryWithProductDetailsByStockId(Stri
}

private List<Bundle> convertToFHIR(List<StockAndProductDetails> stockAndProductDetails) {
return stockAndProductDetails.stream().map(stockAndProductDetail -> StockConverter.convertStockToBundleResource(stockAndProductDetail))
.collect(Collectors.toList());
return stockAndProductDetails.stream().map(stockAndProductDetail -> {
String productNameWithProperWhiteSpacing = Utils.replaceConsecutiveSpaces(stockAndProductDetail.getProductCatalogue().getProductName());
stockAndProductDetail.getProductCatalogue().setProductName(productNameWithProperWhiteSpacing);
return StockConverter.convertStockToBundleResource(stockAndProductDetail);
})
.collect(Collectors.toList());
}

}

0 comments on commit 5b7da62

Please sign in to comment.