feat(commons/recipe): introduce weight sum calculations
This commit is contained in:
parent
b7bbebe222
commit
23447a96d6
1 changed files with 4 additions and 1 deletions
|
|
@ -203,7 +203,10 @@ public class Recipe {
|
|||
final double PER = 100; // Gram
|
||||
return
|
||||
this.ingredients.stream().mapToDouble(RecipeIngredient::getKcal).sum() /
|
||||
this.ingredients.stream().mapToDouble(RecipeIngredient::getBaseAmount).sum() * PER;
|
||||
weight() * PER;
|
||||
}
|
||||
public double weight() {
|
||||
return this.ingredients.stream().mapToDouble(RecipeIngredient::getBaseAmount).sum();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue