HemoCube new Changes

This commit is contained in:
smileomi18@gmail.com
2023-07-24 14:49:51 +05:30
parent 3b042c6587
commit ca403ab862
2 changed files with 4 additions and 4 deletions

View File

@@ -13,7 +13,7 @@ interface UserDao {
fun getAll(): LiveData<List<UserData>> fun getAll(): LiveData<List<UserData>>
@Insert(onConflict = OnConflictStrategy.REPLACE) @Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertAll(userData: com.example.hpostesting.data.model.patient.HemoCubeTestData) suspend fun insertAll(userData: UserData)
@Query("SELECT * FROM user_table WHERE _id = :id") @Query("SELECT * FROM user_table WHERE _id = :id")
suspend fun getUserByID(id: String): UserData suspend fun getUserByID(id: String): UserData

View File

@@ -7,7 +7,7 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.example.hpostesting.data.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.NetworkStatusLiveData import com.example.hpostesting.data.NetworkStatusLiveData
import com.example.hpostesting.data.dao.HemoCubeDb import com.example.hpostesting.data.dao.HemoCubeDao
import com.example.hpostesting.data.model.Response import com.example.hpostesting.data.model.Response
import com.example.hpostesting.data.repository.DatabaseRepository import com.example.hpostesting.data.repository.DatabaseRepository
import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.lifecycle.HiltViewModel
@@ -18,7 +18,7 @@ import java.util.Locale
import javax.inject.Inject import javax.inject.Inject
@HiltViewModel @HiltViewModel
class HemoCubeViewModel@Inject constructor( class HemoCubeViewModel@Inject constructor(
private val hemoCubeDb: HemoCubeDb, private val hemoCubeDao: HemoCubeDao,
private val repository: DatabaseRepository, private val repository: DatabaseRepository,
context: Context context: Context
) : ViewModel() { ) : ViewModel() {
@@ -48,7 +48,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)
hemoCubeDb.insertAll(testDetails!!) hemoCubeDao.insertAll(testDetails!!)
} }
} }
private fun addResultTestToDb() { private fun addResultTestToDb() {