diff --git a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt index 6992399..98e3092 100644 --- a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt +++ b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt @@ -114,8 +114,9 @@ object Constants { val COEFFICIENTS: Map>> = mapOf( "HC-V1-005" to listOf( - listOf(1.5, 0.0), - listOf(0.0, 0.0) + listOf(1.5), + listOf(0.0) ) ) + } \ No newline at end of file diff --git a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt index 238efe5..bc27fc3 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt @@ -396,7 +396,7 @@ class HemoCubeFragment : Fragment() { this.deviceRatio = deviceRatio this.calculatedRatio = calculateRatio(deviceRatio) // this.coefficients = currentDeviceData?.coefficients?.get(0).toString() + ", " + currentDeviceData?.coefficients?.get(1).toString() - this.coefficients = Constants.COEFFICIENTS[deviceId]?.get(0)?.get(0).toString() + "," + Constants.COEFFICIENTS[deviceId]?.get(1)?.get(0).toString() + this.coefficients = Constants.COEFFICIENTS[deviceId]?.get(0).toString() + "," + Constants.COEFFICIENTS[deviceId]?.get(1).toString() this.classificationResult = findResult(calculatedRatio) hemoCubeViewModel.messages.postValue(this.classificationResult) this.resultData = deviceLog @@ -498,8 +498,8 @@ class HemoCubeFragment : Fragment() { } private fun calculateRatio(ratio: Double): Double { - val coefficient1: Double = Constants.COEFFICIENTS[deviceSerialNo]?.get(0)?.get(0) ?: 0.0 - val coefficient2: Double = Constants.COEFFICIENTS[deviceSerialNo]?.get(1)?.get(0) ?: 0.0 + val coefficient1: Double = (Constants.COEFFICIENTS[deviceSerialNo]?.get(0) ?: 0.0) as Double + val coefficient2: Double = (Constants.COEFFICIENTS[deviceSerialNo]?.get(1) ?: 0.0) as Double return coefficient1 * ratio + coefficient2 }