@harvest-profit/units
Advanced tools
Comparing version 1.4.2 to 1.4.3
@@ -95,7 +95,24 @@ "use strict"; | ||
var acresRatio = 1; | ||
var itemAppliedAcres = parseFloat(item.applied_acres); | ||
if (item.split) { | ||
acresRatio = parseFloat(item.applied_acres || 0) / acres; | ||
function isSplit() { | ||
if (item.applied_acres_units === 'percent') return false; | ||
if (Number.isNaN(itemAppliedAcres)) return false; | ||
if (itemAppliedAcres === acres) return false; | ||
return true; | ||
} | ||
function isRatio() { | ||
if (item.applied_acres_units !== 'percent') return false; | ||
if (Number.isNaN(itemAppliedAcres)) return false; | ||
if (itemAppliedAcres === 100) return false; | ||
return true; | ||
} | ||
if (isSplit()) { | ||
acresRatio = itemAppliedAcres / acres; | ||
} else if (isRatio()) { | ||
acresRatio = itemAppliedAcres / 100; | ||
} | ||
if (item.is_total) { | ||
@@ -102,0 +119,0 @@ var total = item.amount * perUnitCost; |
{ | ||
"name": "@harvest-profit/units", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"description": "Units helper for Harvest Profit javascript applications", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53850
502