diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d0792ae..245f817 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -65,12 +65,14 @@
@@ -148,6 +150,7 @@
diff --git a/app/src/main/java/com/example/hpostesting/presentation/deviceprovision/DeviceProvisionFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/deviceprovision/DeviceProvisionFragment.kt
index cd70ad2..61e0299 100644
--- a/app/src/main/java/com/example/hpostesting/presentation/deviceprovision/DeviceProvisionFragment.kt
+++ b/app/src/main/java/com/example/hpostesting/presentation/deviceprovision/DeviceProvisionFragment.kt
@@ -14,13 +14,13 @@ import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.MutableLiveData
-import com.example.hpostesting.data.Result
+import com.example.hpostesting.util.Result
import com.example.hpostesting.data.constant.Constants
import com.example.hpostesting.data.constant.HemoCubeCommands
import com.example.hpostesting.data.model.deviceprovision.DeviceProvisionRequest
import com.example.hpostesting.data.model.patient.DeviceData
import com.example.hpostesting.encryption.Encryption
-import com.example.hpostesting.presentation.UsbServiceListener
+import com.example.hpostesting.presentation.utils.UsbServiceListener
import com.example.hpostesting.presentation.dashboard.DashboardActivity
import com.google.android.gms.ads.identifier.AdvertisingIdClient
import com.google.firebase.crashlytics.ktx.crashlytics
diff --git a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeViewModel.kt b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeViewModel.kt
index 663b324..2036b1e 100644
--- a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeViewModel.kt
+++ b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeViewModel.kt
@@ -160,31 +160,32 @@ class HemoCubeViewModel @Inject constructor(
val resultList = MolbioV2ResultRequest(mutableListOf())
val pendingData = hemoCubeDao.getMolbioPending()
Log.d("molbio","pending size"+pendingData.size)
- pendingData.forEach{
- userData ->
- val currentTimeFormatted = SimpleDateFormat(
- "yyyy-MM-dd'T'HH:mm:ssZZZZZ",
- Locale.getDefault()
- ).format(Calendar.getInstance().time)
- val bufferIntensityThreshold =
- Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId]?.toString()
- ?: "defaultThreshold" // Handle possible nulls safely
- resultList.results?.add(
- MolbioV2Result(
- rawData = userData,
- analysisId = userData._id,
- analysisDate = currentTimeFormatted,
- analysisStatus = userData.classificationResult
- ?: "defaultStatus", // Handle possible nulls
- thresholds = bufferIntensityThreshold,
- interpretation = userData.classificationResult
- ?: "defaultInterpretation", // Handle possible nulls
- testId = userData._id,
- testTime = currentTimeFormatted,
- collectionTime = currentTimeFormatted,
- expiryTime = currentTimeFormatted
+ pendingData.forEach { userData ->
+ if (userData.testStatus == true) {
+ val currentTimeFormatted = SimpleDateFormat(
+ "yyyy-MM-dd'T'HH:mm:ssZZZZZ",
+ Locale.getDefault()
+ ).format(Calendar.getInstance().time)
+ val bufferIntensityThreshold =
+ Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId]?.toString()
+ ?: "defaultThreshold" // Handle possible nulls safely
+ resultList.results?.add(
+ MolbioV2Result(
+ rawData = userData,
+ analysisId = userData._id,
+ analysisDate = currentTimeFormatted,
+ analysisStatus = userData.classificationResult
+ ?: "defaultStatus", // Handle possible nulls
+ thresholds = bufferIntensityThreshold,
+ interpretation = userData.classificationResult
+ ?: "defaultInterpretation", // Handle possible nulls
+ testId = userData._id,
+ testTime = currentTimeFormatted,
+ collectionTime = currentTimeFormatted,
+ expiryTime = currentTimeFormatted
+ )
)
- )
+ }
}
resultList.results?.forEach { result ->
@@ -226,7 +227,7 @@ class HemoCubeViewModel @Inject constructor(
pendingData.forEach{
userData ->
if (userData != null) {
- if (!userData.localFlag) {
+ if (!userData.localFlag && userData.testStatus == true) {
bulkAddResultTestToDb(userData)
}
}