unit test errors

This commit is contained in:
Pritimay Sarkar
2024-01-17 00:20:04 +05:30
parent eb3f1a236d
commit 2c3abe737e
4 changed files with 18 additions and 137 deletions

View File

@@ -46,7 +46,6 @@ class HemoCubeFragment : Fragment() {
private var loginId: String = ""
private var isTestOngoing = false
private var startListening = MutableLiveData<Boolean>(false)
private val testingTrace = Firebase.performance.newTrace("testing_trace")
private var led1BufferForDevice = 0.0
private var led2BufferForDevice = 0.0
private var led3BufferForDevice = 0.0
@@ -408,7 +407,6 @@ class HemoCubeFragment : Fragment() {
getString(R.string.sample_completed) + "\n" + getString(R.string.gathering_data))
fetchResult()
currentResultData = ""
testingTrace.stop()
}
resultData.contains("ovf") -> {
@@ -952,7 +950,6 @@ class HemoCubeFragment : Fragment() {
}
private fun startSampleProcess() {
testingTrace.start()
hemoCubeViewModel.progressBar.postValue(true)
(activity as HemocubeActivity).mService.sendAndListenToHemoCube(HemoCubeCommands.START_SAMPLE,

View File

@@ -39,7 +39,6 @@ import com.example.hpostesting.data.repository.DatabaseRepository
import com.example.hpostesting.data.repository.Repository
import com.example.hpostesting.domain.CheckUpdateWorker
import com.example.hpostesting.domain.LogFileManager
import com.example.hpostesting.data.repository.LocalFileRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import okhttp3.MediaType.Companion.toMediaTypeOrNull
@@ -412,7 +411,6 @@ class HemoCubeViewModel @Inject constructor(
hemoCubeBufferDao.updateFieldById(id = bufferId, true)
}
fun getLocalUserDataForCsv(context: Context): Boolean {
val localUserDataLiveData: LiveData<List<HemoCubeTestData>> = hemoCubeDao.getAll()
@@ -447,24 +445,24 @@ class HemoCubeViewModel @Inject constructor(
}
private fun getCurrentDate(): String {
val dateFormat = SimpleDateFormat("dd-MM-yy", Locale.getDefault())
val currentDate = Date()
return dateFormat.format(currentDate)
}
val dateFormat = SimpleDateFormat("dd-MM-yy", Locale.getDefault())
val currentDate = Date()
return dateFormat.format(currentDate)
}
fun createCSV(hemoCubeTestData: List<HemoCubeTestData>, appContext: Context) =
viewModelScope.launch {
val fileName = "HPOS${getCurrentDate()}.csv"
if (localFileDataSource.exportDataToCSV(fileName, hemoCubeTestData)) {
hemoCubeTestData.forEach { data ->
data.localFlag = true
hemoCubeDao.updateCSVFieldById(
data._id,
true
)
}
viewModelScope.launch {
val fileName = "HPOS${getCurrentDate()}.csv"
if (localFileDataSource.exportDataToCSV(fileName, hemoCubeTestData)) {
hemoCubeTestData.forEach { data ->
data.localFlag = true
hemoCubeDao.updateCSVFieldById(
data._id,
true
)
}
}
}
fun getBatteryLevel(): Float? {
val batteryPct: Float? = batteryStatus?.let { intent ->