Skip to content

Commit

Permalink
remove call to this.updateQuantities that is already handled by super…
Browse files Browse the repository at this point in the history
…class, #78
  • Loading branch information
pixelzoom committed Mar 3, 2023
1 parent 4e7cbc6 commit 62aead6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/common/model/Reaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class Reaction {
/*
* Updates the quantities of products and leftovers.
*/
protected updateQuantities(): void {
private updateQuantities(): void {
const numberOfReactions = this.getNumberOfReactions();
this.products.forEach( product => {
product.quantityProperty.value = numberOfReactions * product.coefficientProperty.value;
Expand Down
2 changes: 1 addition & 1 deletion js/sandwiches/model/SandwichRecipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ export default class SandwichRecipe extends Reaction {

super( [ bread, meat, cheese ], [ sandwich ], { nameProperty: nameProperty } );

// Updates the sandwich (product) icon
Multilink.multilink(
[ bread.coefficientProperty, meat.coefficientProperty, cheese.coefficientProperty ],
( breadCoefficient, meatCoefficient, cheeseCoefficient ) => {
this.updateQuantities();
sandwich.iconProperty.value = this.isReaction() ?
new SandwichNode( breadCoefficient, meatCoefficient, cheeseCoefficient ) :
NO_SANDWICH_NODE;
Expand Down

0 comments on commit 62aead6

Please sign in to comment.