Merge remote-tracking branch 'origin/dev-without-firebase-integration' into dev-without-firebase-integration
This commit is contained in:
@@ -52,5 +52,6 @@ interface HemoCubeDao {
|
|||||||
|
|
||||||
@Query("SELECT * from hemo_cube_test_table WHERE localFlag = 0")
|
@Query("SELECT * from hemo_cube_test_table WHERE localFlag = 0")
|
||||||
fun getPendingUser(): LiveData<List<HemoCubeTestData>>
|
fun getPendingUser(): LiveData<List<HemoCubeTestData>>
|
||||||
|
@Update
|
||||||
|
suspend fun updateTest(hemoCubeTestData: HemoCubeTestData)
|
||||||
}
|
}
|
||||||
@@ -43,6 +43,7 @@ data class UserData(
|
|||||||
var result: TestRightResultType? = null,
|
var result: TestRightResultType? = null,
|
||||||
var resultRatio: Double? = null,
|
var resultRatio: Double? = null,
|
||||||
var prdClassification: String = "",
|
var prdClassification: String = "",
|
||||||
|
var sampleid: Int = 0
|
||||||
) {
|
) {
|
||||||
enum class Gender {
|
enum class Gender {
|
||||||
MALE,
|
MALE,
|
||||||
@@ -60,6 +61,8 @@ fun UserData.toHemoCubeTestData() = HemoCubeTestData(
|
|||||||
_id = _id,
|
_id = _id,
|
||||||
name = name,
|
name = name,
|
||||||
bloodGroup = bloodGroup,
|
bloodGroup = bloodGroup,
|
||||||
|
sampleid = sampleid,
|
||||||
|
incubationTime = incubationTime,
|
||||||
birthYear = birthYear,
|
birthYear = birthYear,
|
||||||
gender = gender,
|
gender = gender,
|
||||||
state = state,
|
state = state,
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int)
|
|||||||
).show()
|
).show()
|
||||||
} else {
|
} else {
|
||||||
DataHolder.selectedTest = UserData(
|
DataHolder.selectedTest = UserData(
|
||||||
|
sampleid = userList.sampleid,
|
||||||
_id = userList._id,
|
_id = userList._id,
|
||||||
bloodGroup = userList.bloodGroup,
|
bloodGroup = userList.bloodGroup,
|
||||||
incubationTime = userList.incubationTime
|
incubationTime = userList.incubationTime
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
testDetails?.testTime = SimpleDateFormat(
|
testDetails?.testTime = SimpleDateFormat(
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
hemoCubeDao.insertAll(testDetails!!)
|
hemoCubeDao.updateTest(testDetails!!)
|
||||||
fireBaseUpload.postValue("Local")
|
fireBaseUpload.postValue("Local")
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -423,7 +423,6 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
testDetails!!.reportUploadTime = SimpleDateFormat(
|
testDetails!!.reportUploadTime = SimpleDateFormat(
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
hemoCubeDao.insertAll(testDetails)
|
|
||||||
// when (val response = repository.addTestToDatabase(testDetails)) {
|
// when (val response = repository.addTestToDatabase(testDetails)) {
|
||||||
// is Response.Success -> {
|
// is Response.Success -> {
|
||||||
// val kitCount = sharedPreference.getInt(Constants.KIT_COUNT, 0)
|
// val kitCount = sharedPreference.getInt(Constants.KIT_COUNT, 0)
|
||||||
@@ -474,7 +473,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
hemoCubeDao.insertAll(testDetails)
|
hemoCubeDao.updateTest(testDetails)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("Testdb", "Exception during data upload: ${e.message}")
|
Log.e("Testdb", "Exception during data upload: ${e.message}")
|
||||||
|
|||||||
Reference in New Issue
Block a user