Issues fixed

This commit is contained in:
Mariya
2023-12-06 11:32:38 +05:30
parent 045eaee578
commit 326c66fea7
2 changed files with 6 additions and 5 deletions

View File

@@ -114,8 +114,9 @@ object Constants {
val COEFFICIENTS: Map<String, List<List<Double>>> = mapOf(
"HC-V1-005" to listOf(
listOf(1.5, 0.0),
listOf(0.0, 0.0)
listOf(1.5),
listOf(0.0)
)
)
}

View File

@@ -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
}