Skip to content

Commit

Permalink
Merge pull request #1338 from dhis2/develop
Browse files Browse the repository at this point in the history
fix: [DEVELOP] Fix datavalue update
  • Loading branch information
vgarciabnz authored Jul 31, 2020
2 parents 244b47e + 76cdd08 commit 3a02595
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,22 @@ public void set_state_to_delete_if_state_is_not_to_post() throws D2Error {
assertThat(repository.blockingGet().state(), is(State.TO_UPDATE));
}

@Test
public void set_not_deleted_when_updating_deleted_value() throws D2Error {
DataValueObjectRepository repository = objectRepository();

repository.blockingSet("value");
DataValueStore.create(databaseAdapter).setState(repository.blockingGet(), State.TO_UPDATE);

repository.blockingDelete();
assertThat(repository.blockingGet().state(), is(State.TO_UPDATE));
assertThat(repository.blockingGet().deleted(), is(Boolean.TRUE));

repository.blockingSet("new_value");
assertThat(repository.blockingGet().state(), is(State.TO_UPDATE));
assertThat(repository.blockingGet().deleted(), is(Boolean.FALSE));
}

@Test
public void return_that_a_value_exists_only_if_it_has_been_created() {
assertThat(d2.dataValueModule().dataValues()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public Completable set(String value) {
}

public void blockingSet(String value) throws D2Error {
DataValue objectWithValue = setBuilder().value(value).build();
DataValue objectWithValue = setBuilder().value(value).deleted(false).build();
setObject(objectWithValue);
}

Expand Down

0 comments on commit 3a02595

Please sign in to comment.