Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
- Add `Suspected` flag to recent patient list item
- Update diagnosis required error dialog to include referral feature

### Fixes

- Fix `updated_at` not updating when a business identifier is updated

## 2025.09.09

### Internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import org.simple.clinic.util.UtcClock
import org.simple.clinic.util.filterAndUnwrapJust
import org.simple.clinic.util.scheduler.SchedulersProvider
import org.simple.clinic.uuid.UuidGenerator
import java.time.Instant
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.util.UUID
Expand Down Expand Up @@ -267,7 +268,12 @@ class EditPatientEffectHandler @AssistedInject constructor(
private fun updateAlternativeId(savePatientEffects: Observable<SavePatientEffect>): Observable<EditPatientEvent> {
return savePatientEffects
.filter(::isAlternativeIdModified)
.map { it.saveAlternativeId?.updateIdentifierValue(it.ongoingEntry.alternativeId) }
.map {
it.saveAlternativeId?.updateIdentifierValue(
newValue = it.ongoingEntry.alternativeId,
updatedAt = Instant.now(utcClock)
)
}
.flatMapCompletable { patientRepository.saveBusinessId(it) }
.toObservable()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ data class BusinessId(
)
}

fun updateIdentifierValue(newValue: String): BusinessId =
copy(identifier = identifier.copy(value = newValue))
fun updateIdentifierValue(newValue: String, updatedAt: Instant): BusinessId =
copy(
identifier = identifier.copy(value = newValue),
updatedAt = updatedAt
)

sealed class MetaDataVersion : Parcelable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@ class EditPatientEffectHandlerTest {
// given
val bangladeshNationalIdText = "1569273"
val ongoingEntryWithBangladeshId = entry.updateAlternativeId(bangladeshNationalIdText)
val updatedBangladeshNationalId = bangladeshNationalId.updateIdentifierValue(bangladeshNationalIdText)
val now = Instant.now(utcClock)
val updatedBangladeshNationalId =
bangladeshNationalId.updateIdentifierValue(
newValue = bangladeshNationalIdText,
updatedAt = now
)

whenever(patientRepository.updatePatient(patient)) doReturn Completable.complete()
whenever(patientRepository.updateAddressForPatient(patient.uuid, patientAddress)) doReturn Completable.complete()
Expand Down