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

Fixed displaying saved forms to delete #6107

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Apr 24, 2024

Closes #6017

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

I could have edited InstancesDataService by adding a new flow specifically for undelete instances (and read them from the repository) but:

  1. This would make testing more difficult than what I did because I would need to rework the view model test completely so that it tests a real InstancesDataService object.
  2. I'm not sure if exposing different flows for different scenarios (all instances, undelete instances, etc) is what we want to have in our data service. Maybe exposing just one like now is clearer.

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 fix filtering forms to delete so that the soft-deleted ones (forms that have already been deleted but still exist in the database so that we can keep track of sent forms for example). are not displayed on the list.

Do we need any specific form for testing your changes? If so, please attach one.

No.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

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
  • 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

@grzesiek2010 grzesiek2010 requested a review from seadowg April 24, 2024 10:55
Copy link
Member

@seadowg seadowg left a comment

Choose a reason for hiding this comment

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

It looks like there's some conflicts blocking this.

I could have edited InstancesDataService by adding a new flow specifically for undelete instances (and read them from the repository) but:

  1. This would make testing more difficult than what I did because I would need to rework the view model test completely so that it tests a real InstancesDataService object.
  2. I'm not sure if exposing different flows for different scenarios (all instances, undelete instances, etc) is what we want to have in our data service. Maybe exposing just one like now is clearer.

Good points. I guess it's a trade off, if we expose different Flows/LiveData values for different "filters" over the data then there is definitely more complexity in the data service to manage this and more API to care about from clients. On the other hand, exposing "everything" and then filtering in memory will definitely be less efficient than pushing that work all the way to the DB. I think sticking with the least change for now (what you've done) is a good idea. If we do need to change it later once we're using the data service for all our lists, we'll be better informed to make that decision then.

@@ -142,7 +142,7 @@ class DeleteFormsActivity : LocalizedActivity() {
showAllVersions = true
)

SavedFormListViewModel::class.java -> SavedFormListViewModel(
DeleteSavedFormListViewModel::class.java -> DeleteSavedFormListViewModel(
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about this rename. I was envisioning that we'd be able to use SavedFormListViewModel in other places (like "Drafts") in the future. But, maybe it makes more sense to have this (DeleteSavedFormListViewModel) name now and rename in the future if we do end up generalising it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I thought that with the new changes that view model could not be shared but that's not true in Drafts as you said we would also need to filter out deleted forms. I've removed that change.

@seadowg seadowg merged commit b3cd4a0 into getodk:master Apr 29, 2024
6 checks passed
@WKobus
Copy link

WKobus commented May 6, 2024

Tested with Success!

Verified on device with Android: 11

Verified cases:

@dbemke
Copy link

dbemke commented May 6, 2024

Tested with Success!

Verified on device with Android: 10

@srujner
Copy link

srujner commented May 6, 2024

Tested with Success!

Verified on device with Android: 13

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.

Deleting a sent form in "Delete form- Saved Forms" doesn’t remove the form from the list
5 participants