Skip to content

Commit

Permalink
Merge pull request #6393 from seadowg/entity-crashes
Browse files Browse the repository at this point in the history
Allow null labels in follow up forms
  • Loading branch information
grzesiek2010 authored Sep 9, 2024
2 parents 7c8e437 + cb8a353 commit e076a34
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ class LocalEntitiesInstanceAdapter(private val entitiesRepository: EntitiesRepos

if (!partial) {
name.value = StringData(entity.id)
label.value = StringData(entity.label)
version.value = StringData(entity.version.toString())
branchId.value = StringData(entity.branchId)

if (entity.label != null) {
label.value = StringData(entity.label)
}

if (entity.trunkVersion != null) {
trunkVersion.value = StringData(entity.trunkVersion.toString())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,21 @@ class LocalEntitiesInstanceProviderTest {
assertThat(second.getFirstChild("name")!!.value!!.value, equalTo("2"))
assertThat(second.multiplicity, equalTo(1))
}

@Test
fun `includes blank label version when it is null`() {
val entity =
Entity.New(
"1",
label = null
)
entitiesRepository.save("people", entity)

val parser = LocalEntitiesInstanceProvider { entitiesRepository }
val instance = parser.get("people", "people.csv")
assertThat(instance.numChildren, equalTo(1))

val item = instance.getChildAt(0)!!
assertThat(item.getFirstChild(EntityItemElement.LABEL)?.value, equalTo(null))
}
}

0 comments on commit e076a34

Please sign in to comment.