Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix forms not being deletable #6369

Merged
merged 2 commits into from
Aug 27, 2024
Merged

Conversation

seadowg
Copy link
Member

@seadowg seadowg commented Aug 22, 2024

Closes #6338

Why is this the best possible solution? Were any other approaches considered?

Not a lot to discuss! The problem was just that Instance objects created via Instance.Builder had the wrong default value.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

This should just fix the issue. It'll be good to check that forms can be deleted when expected.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@seadowg seadowg changed the title Fix forms not be deletable Fix forms not being deletable Aug 22, 2024
@seadowg seadowg marked this pull request as ready for review August 22, 2024 13:49
@seadowg seadowg requested a review from grzesiek2010 August 27, 2024 11:32
class InstanceTest {

@Test
fun `canDeleteBeforeSend is true by default`() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have that test whenFormHasCreatedEntity_doesNotAppearInListToDelete:

  1. Please clarify what created entity means. You can add a comment or change the test name to make it clear that it takes place on finalizing.
  2. I think it would be good to have a test in the same class where we just save a form as a draft and test if it can be deleted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to have a test in the same class where we just save a form as a draft and test if it can be deleted.

I'd thought about that (I actually wrote that test then deleted it), but I realized we already had a test for finalized forms and felt like adding this unit test was simpler than testing all the possible states that saved forms could be in.

@@ -83,7 +83,7 @@ public static class Builder {
private String geometry;

private Long dbId;
private boolean canDeleteBeforeSend;
private boolean canDeleteBeforeSend = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it handled correctly when forms are synced from disk and should be finalized?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean if a form has an entity? We don't currently support local entity creation/updates for synced instances. Otherwise, every Instance should now be deletable.

@seadowg seadowg requested a review from grzesiek2010 August 27, 2024 13:14
@grzesiek2010 grzesiek2010 merged commit 9d5e3ae into getodk:master Aug 27, 2024
6 checks passed
@seadowg seadowg deleted the fix-delete branch August 27, 2024 14:24
@WKobus
Copy link

WKobus commented Aug 28, 2024

Sent instances of forms that create or update entity still can't be deleted, those instances do not appear in delete form - saved forms.
Sent instances of non entity forms work correctly and those appear in saved forms - delete forms.
@seadowg

@seadowg
Copy link
Member Author

seadowg commented Aug 28, 2024

Sent instances of forms that create or update entity still can't be deleted, those instances do not appear in delete form - saved forms.
Sent instances of non entity forms work correctly and those appear in saved forms - delete forms.

Could you file an issue? As far as I can tell, we should be OK to delete sent forms that create/update entities. We can discuss over at the issue though.

@WKobus
Copy link

WKobus commented Aug 28, 2024

Tested with Success

Verified on device with Android 14

Verified cases:

  • Deleting drafts, finalized and sent instances of forms that create or update entity
  • Deleting drafts, finalized and sent instances of non entity forms
  • Forms with auto delete

@dbemke
Copy link

dbemke commented Aug 28, 2024

Tested with Success

Verified on device with Android 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not possible to delete drafts and sent instances of form that create or update entity
4 participants