Skip to content

Commit

Permalink
Fixed calculation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lentschi committed Jul 15, 2022
1 parent 32f478d commit 1e328cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions app/assets/javascripts/group-order-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ class GroupOrderForm {
if (isNaN(tolerance)) {
tolerance = 0;
}
const packSize = quantity$.data('ratio-group-order-unit-supplier-unit');
const othersQuantity = quantity$.data('others-quantity');
const othersTolerance = quantity$.data('others-tolerance');
const usedQuantity = quantity$.data('used-quantity');
const minimumOrderQuantity = quantity$.data('minimum-order-quantity');
const price = quantity$.data('price');
const packSize = parseFloat(quantity$.data('ratio-group-order-unit-supplier-unit'));
const othersQuantity = parseFloat(quantity$.data('others-quantity'));
const othersTolerance = parseFloat(quantity$.data('others-tolerance'));
const usedQuantity = parseFloat(quantity$.data('used-quantity'));
const minimumOrderQuantity = parseFloat(quantity$.data('minimum-order-quantity'));
const price = parseFloat(quantity$.data('price'));

const totalQuantity = quantity + othersQuantity;
const totalTolerance = tolerance + othersTolerance;
Expand Down
2 changes: 1 addition & 1 deletion app/views/group_orders/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
%i.icon-plus

%td.tolerance.group-order-input{style: ('display:none' if @order.stockit?)}
- if (@ordering_data[:order_articles][order_article.id][:ratio_group_order_unit_supplier_unit] != 1 || (order_article.price.minimum_order_quantity.presence || 0) > order_article.price.group_order_granularity)
- if (@ordering_data[:order_articles][order_article.id][:ratio_group_order_unit_supplier_unit] != order_article.price.group_order_granularity || (order_article.price.minimum_order_quantity.presence || 0) > order_article.price.group_order_granularity)
%span.used= @ordering_data[:order_articles][order_article.id][:used_tolerance]
+
%span.unused= @ordering_data[:order_articles][order_article.id][:tolerance] - @ordering_data[:order_articles][order_article.id][:used_tolerance]
Expand Down

0 comments on commit 1e328cd

Please sign in to comment.