changed the time zone for result upload for molbio

This commit is contained in:
Mariya
2024-04-05 14:23:51 +05:30
parent c825ebbda3
commit 73d7db010c
2 changed files with 13 additions and 10 deletions

View File

@@ -377,11 +377,11 @@ class HomeFragment : Fragment() {
val encryptedString = file.readText() val encryptedString = file.readText()
val encryptionKey = val encryptionKey =
Settings.Secure.getString(context?.contentResolver, Settings.Secure.ANDROID_ID) Settings.Secure.getString(context?.contentResolver, Settings.Secure.ANDROID_ID)
// val decryptedMessage: String = Encryption.decrypt(encryptedString, encryptionKey) val decryptedMessage: String = Encryption.decrypt(encryptedString, encryptionKey)
// val credentials = decryptedMessage.split("\n") val credentials = decryptedMessage.split("\n")
// userID = credentials[0] userID = credentials[0]
// password = credentials[1] password = credentials[1]
// Toast.makeText(context, "DECRYPTED: $credentials", Toast.LENGTH_SHORT).show() Toast.makeText(context, "DECRYPTED: $credentials", Toast.LENGTH_SHORT).show()
if (!isTokenAvailable) { if (!isTokenAvailable) {
hemoCubeViewModel.login(createLoginRequestData(userID, password)) hemoCubeViewModel.login(createLoginRequestData(userID, password))
} }

View File

@@ -423,7 +423,10 @@ 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)
val currentTimeFormatted = SimpleDateFormat(
"yyyy-MM-dd'T'HH:mm:ssZZZZZ",
Locale.getDefault()
).format(Calendar.getInstance().time)
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)
@@ -445,14 +448,14 @@ class HemoCubeViewModel @Inject constructor(
MolbioV2Result( MolbioV2Result(
rawData = sanitizedTestDetails, rawData = sanitizedTestDetails,
analysisId = sanitizedTestDetails._id, analysisId = sanitizedTestDetails._id,
analysisDate = sanitizedTestDetails.testTime, analysisDate = currentTimeFormatted,
analysisStatus = sanitizedTestDetails.classificationResult, analysisStatus = sanitizedTestDetails.classificationResult,
thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[sanitizedTestDetails.deviceId]?.toString(), thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[sanitizedTestDetails.deviceId]?.toString(),
interpretation = sanitizedTestDetails.classificationResult, interpretation = sanitizedTestDetails.classificationResult,
testId = sanitizedTestDetails._id, testId = sanitizedTestDetails._id,
testTime = sanitizedTestDetails.testTime, testTime = currentTimeFormatted,
collectionTime = sanitizedTestDetails.testTime, collectionTime = currentTimeFormatted,
expiryTime = sanitizedTestDetails.testTime, expiryTime = currentTimeFormatted,
) )
) )
) )