Skip to content

Commit

Permalink
fix: [1.10.0.1] Hotfix version 1.10.0.1 (#2164)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgarciabnz authored Jun 12, 2024
2 parents a542a0f + cf7571b commit 1505be7
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ internal abstract class IdentifiableDataHandlerImpl<O>(
relatives: RelationshipItemRelatives?,
)

protected fun beforeCollectionHandled(
protected open fun beforeCollectionHandled(
oCollection: Collection<O>,
params: IdentifiableDataHandlerParams,
): Collection<O> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import org.hisp.dhis.android.core.note.Note
import org.hisp.dhis.android.core.note.internal.NoteDHISVersionManager
import org.hisp.dhis.android.core.note.internal.NoteHandler
import org.hisp.dhis.android.core.note.internal.NoteUniquenessManager
import org.hisp.dhis.android.core.program.ProgramType
import org.hisp.dhis.android.core.program.internal.ProgramStore
import org.hisp.dhis.android.core.relationship.internal.EventRelationshipOrphanCleaner
import org.hisp.dhis.android.core.relationship.internal.RelationshipDHISVersionManager
import org.hisp.dhis.android.core.relationship.internal.RelationshipHandler
Expand All @@ -53,18 +55,33 @@ internal class EventHandler(
relationshipVersionManager: RelationshipDHISVersionManager,
relationshipHandler: RelationshipHandler,
eventStore: EventStore,
private val programStore: ProgramStore,
private val trackedEntityDataValueHandler: TrackedEntityDataValueHandler,
private val noteHandler: NoteHandler,
private val noteVersionManager: NoteDHISVersionManager,
private val noteUniquenessManager: NoteUniquenessManager,
private val relationshipOrphanCleaner: EventRelationshipOrphanCleaner,
) : IdentifiableDataHandlerImpl<Event>(eventStore, relationshipVersionManager, relationshipHandler) {

override fun beforeCollectionHandled(
oCollection: Collection<Event>,
params: IdentifiableDataHandlerParams,
): Collection<Event> {
val programTypes = programStore.selectAll().associate { it.uid() to it.programType() }

val updatedEvents = oCollection.map {
it.takeUnless { programTypes[it.program()] == ProgramType.WITHOUT_REGISTRATION }
?: it.toBuilder().enrollment(null).build()
}

return super.beforeCollectionHandled(updatedEvents, params)
}

override fun beforeObjectHandled(o: Event, params: IdentifiableDataHandlerParams): Event {
return if (GeometryHelper.isValid(o.geometry())) {
o
} else {
Log.i(this.javaClass.simpleName, "Event " + o.uid() + " has invalid geometry value")
Log.i(this::class.simpleName, "Event ${o.uid()} has an invalid geometry value")
o.toBuilder().geometry(null).build()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"program": "lxAQ7Zs9VYR",
"event": "single1",
"status": "COMPLETED",
"enrollment": "u9mt5Z8assp",
"occurredAt": "2018-02-27T00:00:00.000",
"createdAt": "2017-08-07T15:47:25.959",
"completedAt": "2016-02-27T00:00:00.000",
Expand Down Expand Up @@ -112,6 +113,7 @@
"program": "lxAQ7Zs9VYR",
"event": "single2",
"status": "ACTIVE",
"enrollment": "u9mt5Z8assp",
"occurredAt": "2017-02-27T00:00:00.000",
"createdAt": "2018-08-07T15:47:25.959",
"completedAt": "2018-02-27T00:00:00.000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import org.hisp.dhis.android.core.note.Note
import org.hisp.dhis.android.core.note.internal.NoteDHISVersionManager
import org.hisp.dhis.android.core.note.internal.NoteHandler
import org.hisp.dhis.android.core.note.internal.NoteUniquenessManager
import org.hisp.dhis.android.core.program.internal.ProgramStore
import org.hisp.dhis.android.core.relationship.internal.EventRelationshipOrphanCleaner
import org.hisp.dhis.android.core.relationship.internal.RelationshipDHISVersionManager
import org.hisp.dhis.android.core.relationship.internal.RelationshipHandler
Expand All @@ -51,6 +52,7 @@ import org.junit.runners.JUnit4
@RunWith(JUnit4::class)
class EventHandlerShould {
private val eventStore: EventStore = mock()
private val programStore: ProgramStore = mock()
private val trackedEntityDataValueHandler: TrackedEntityDataValueHandler = mock()
private val trackedEntityDataValue: TrackedEntityDataValue = mock()
private val noteHandler: NoteHandler = mock()
Expand Down Expand Up @@ -84,6 +86,7 @@ class EventHandlerShould {
relationshipVersionManager,
relationshipHandler,
eventStore,
programStore,
trackedEntityDataValueHandler,
noteHandler,
noteVersionManager,
Expand Down
2 changes: 1 addition & 1 deletion docs/content/developer/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Include dependency in build.gradle.

```gradle
dependencies {
implementation "org.hisp.dhis:android-core:1.10.0"
implementation "org.hisp.dhis:android-core:1.10.0.1"
...
}
```
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
dhis2AndroidSdkVersion = "1.10.0-SNAPSHOT"
dhis2AndroidSdkCode = "292"
dhis2AndroidSdkVersion = "1.10.0.1-SNAPSHOT"
dhis2AndroidSdkCode = "293"

gradle = "8.3.1"
kotlin = "1.9.21"
Expand Down

0 comments on commit 1505be7

Please sign in to comment.