2019-09-01 19:09:36 +02:00
|
|
|
import neckstimate from '../neckstimate'
|
|
|
|
|
|
|
|
// This returns how many sizes a measurement differs from the neckstimate value
|
2019-09-09 12:06:04 +02:00
|
|
|
// 0 and 2 is great
|
|
|
|
// 2 to 5 is hmmm
|
|
|
|
// and above 5 is probably wrong
|
2019-09-01 19:09:36 +02:00
|
|
|
const measurementDiffers = (
|
|
|
|
neckCircumference,
|
|
|
|
measurementName,
|
|
|
|
measurementValue,
|
2021-05-30 18:27:53 +02:00
|
|
|
breasts = false,
|
|
|
|
absolute = true
|
|
|
|
) => {
|
|
|
|
let result = Math.round((measurementValue - neckstimate(neckCircumference, measurementName, breasts)) / 20)
|
|
|
|
|
|
|
|
return absolute
|
|
|
|
? Math.abs(Math.round((measurementValue - neckstimate(neckCircumference, measurementName, breasts)) / 20))
|
|
|
|
: (measurementValue - neckstimate(neckCircumference, measurementName, breasts, true)) / 20
|
|
|
|
}
|
2019-09-01 19:09:36 +02:00
|
|
|
|
|
|
|
export default measurementDiffers
|