Added Device Data and HemoCube Schema
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.example.hpostesting.data.dao
|
||||
|
||||
import androidx.room.TypeConverter
|
||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||
import com.example.hpostesting.data.model.patient.UserData
|
||||
import com.google.gson.Gson
|
||||
|
||||
@@ -25,23 +24,23 @@ class Converters {
|
||||
}
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun fromLocation(value: String?): HemoCubeTestData.Location? {
|
||||
return if (value != null) {
|
||||
gson.fromJson(value, HemoCubeTestData.Location::class.java)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@TypeConverter
|
||||
fun toLocation(location: HemoCubeTestData.Location?): String? {
|
||||
return if (location != null) {
|
||||
gson.toJson(location)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
// @TypeConverter
|
||||
// fun fromLocation(value: String?): UserData.Location? {
|
||||
// return if (value != null) {
|
||||
// gson.fromJson(value, UserData.Location::class.java)
|
||||
// } else {
|
||||
// null
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// @TypeConverter
|
||||
// fun toLocation(location: UserData.Location?): String? {
|
||||
// return if (location != null) {
|
||||
// gson.toJson(location)
|
||||
// } else {
|
||||
// null
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -10,7 +10,7 @@ data class HemoCubeTestData(
|
||||
var name: String = "",
|
||||
var birthYear: String = "",
|
||||
var userImageURL: String = "",
|
||||
var location: Location? = null,
|
||||
var location: UserData.Location? = null,
|
||||
var reportUploadTime: String? = "",
|
||||
var testType: String? = "HEMOCUBE",
|
||||
var testTime: String? = "",
|
||||
@@ -26,9 +26,4 @@ data class HemoCubeTestData(
|
||||
var led2Avarage: Double? = null,
|
||||
var deviceRatio: Double? = null,
|
||||
var calculatedRatio: Double? = null
|
||||
){
|
||||
data class Location(
|
||||
var latitude: Double? = null,
|
||||
var longitude: Double? = null
|
||||
)
|
||||
}
|
||||
|
||||
@@ -42,14 +42,5 @@ fun UserData.toHemoCubeTestData() = HemoCubeTestData(
|
||||
name = name,
|
||||
birthYear = birthYear,
|
||||
userImageURL = userImageURL,
|
||||
location = location,
|
||||
createdBy = createdBy,
|
||||
reportUploadTime = reportUploadTime,
|
||||
testTime = testTime,
|
||||
testStatus = testStatus,
|
||||
mobileId = mobileId,
|
||||
deviceSerialNumber = deviceSerialNumber,
|
||||
kitSerial = kitSerial,
|
||||
reportPath = reportPath,
|
||||
resultRatio = resultRatio,
|
||||
)
|
||||
|
||||
@@ -62,7 +62,7 @@ class HemoCubeViewModel @Inject constructor(
|
||||
}
|
||||
|
||||
private fun addResultTestToDb() {
|
||||
testDetails?.resultRatio = DataHolder.hemocubeResult
|
||||
testDetails?.deviceRatio = DataHolder.hemocubeResult
|
||||
testDetails?.resultData = DataHolder.hemoCubeTestData?.resultData.toString()
|
||||
testDetails?.location = DataHolder.location
|
||||
testDetails?.testTime = SimpleDateFormat(
|
||||
|
||||
Reference in New Issue
Block a user