Merge pull request 'Fix in stock calculation. closes #118' (#119) from feature/display_article_shop_in_stock into master
Reviewed-on: #119 Reviewed-by: Jannik Seiler <seil0@mosad.xyz>
This commit is contained in:
commit
63e9bc2336
|
@ -52,7 +52,11 @@ public class ShopArticleController {
|
||||||
}
|
}
|
||||||
model.addAttribute("article", article);
|
model.addAttribute("article", article);
|
||||||
|
|
||||||
if (warehouseBookingPositionSlotEntryRepository.getByArticle(id).get(0).newSumSlot > 0) { //check if in Stock
|
if (warehouseBookingPositionSlotEntryRepository
|
||||||
|
.getByArticle(id)
|
||||||
|
.stream()
|
||||||
|
.mapToInt(e -> e.newSumSlot)
|
||||||
|
.sum() > 0) { //check if in Stock
|
||||||
model.addAttribute("inStock", true);
|
model.addAttribute("inStock", true);
|
||||||
} else {
|
} else {
|
||||||
model.addAttribute("inStock", false);
|
model.addAttribute("inStock", false);
|
||||||
|
|
Reference in New Issue