Skip to content

Commit

Permalink
Refactor option_value_value_unit_scaled for correct unit value scalin…
Browse files Browse the repository at this point in the history
…g and update sales tax report spec for clarity
  • Loading branch information
Neal Chambers authored and macanudo527 committed Nov 13, 2024
1 parent 41ffe84 commit 7a5074c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/services/variant_units/option_value_namer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def option_value_value_unit
def option_value_value_unit_scaled
unit_scale, unit_name = scale_for_unit_value

value = (@nameable.unit_value / unit_scale).to_d.round(2)
value = (@nameable.unit_value.to_d / unit_scale).round(2)

[value, unit_name]
end
Expand Down
3 changes: 2 additions & 1 deletion spec/lib/reports/sales_tax_totals_by_order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@
total = report.total_excl_tax(query_row)

# discounted order total - discounted order tax
expect(total).to eq((BigDecimal('113.3') - 10) - (BigDecimal('3.3') - BigDecimal('0.29')))
# (113.3 - 10) - (3.3 - 0.29)
expect(total).to eq 100.29
end
end
end
Expand Down

0 comments on commit 7a5074c

Please sign in to comment.