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

Refine form saving language #5569

Merged
merged 12 commits into from
May 9, 2023

Conversation

grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented May 4, 2023

Closes #5417

What has been done to verify that this works as intended?

I've tested the changes manually and updated automated tests.

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

There is nothing important to discuss here.

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?

Please test the changes according to the acceptance criteria described in the issue. The biggest source of bugs might be mixing autosend settings - disabling/enabling autosend in settings and then doing the same on a form level. Then we can end up with:

  • autosend disabled in setting and enabled on a form level
  • autosend enabled in setting and disabled on a form level
  • etc.

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:

  • run ./gradlew checkAll and confirmed all checks still pass OR confirm CircleCI build passes and run ./gradlew connectedDebugAndroidTest locally.
  • 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 marked this pull request as ready for review May 4, 2023 18:00
@grzesiek2010 grzesiek2010 requested a review from seadowg May 4, 2023 18:00
@grzesiek2010 grzesiek2010 added the high priority Should be looked at before other PRs/issues label May 5, 2023
@grzesiek2010 grzesiek2010 requested a review from seadowg May 8, 2023 11:17
binding.finalize.setOnClickListener {
listener.onSaveClicked(true)
}
if (formEndViewModel.shouldFormBeSentAutomatically(form)) {
Copy link
Member

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 for FormEndViewModel to encapsulate any accesses to Form here so that we don't need to pass one in to FormEndView for this. The ViewModel could use a similar method to FormEntryViewModel, FormSaveViewModel etc to load the form from the FormSessionRepository.

I think the formTitle param should really be dropped and should also be something the view gets from the ViewModel. This might require quite a chunk of rework however (as this data gets passed around between ViewModels), so I could understand it feeling like something we should punt on for the moment.

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 agree regarding the first part but I wasn't sure how to handle this to make the code clean. What do you think about 477b025 and keeping a formController and a form objects in the same repository? I think creating a separate repository just for the form object would be weird, they are both kind of a formSession so probably we should keep the both in the same place.

Copy link
Member

Choose a reason for hiding this comment

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

That makes a lot of sense to me! I could see that we'll probably also want Instance (probably optional) on the form session eventually.

@grzesiek2010 grzesiek2010 requested a review from seadowg May 9, 2023 08:05
@@ -566,7 +573,7 @@ private void setupViewModels(FormEntryViewModelFactory formEntryViewModelFactory
}

private void formControllerAvailable(@NonNull FormController formController) {
formSessionRepository.set(sessionId, formController);
formSessionRepository.set(sessionId, formController, formsRepository.getOneByPath(formPath));
Copy link
Member

Choose a reason for hiding this comment

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

I was wondering if we could avoid the extra DB lookup here, but it seems like that would be awkward. I'd hope that eventually the whole form load (loading from the DB and creating the JavaRosa objects) will happen in one neat place that could then set the form session after it's done.

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 was thinking about passing form/instance objects from FormUriActivity to FormFillingActivity so that FormFillingActivity does not have to deal with that since FormUriActivity needs to read the database and validate the output either way. But that's something for the future.

@grzesiek2010 grzesiek2010 merged commit 44a50c0 into getodk:master May 9, 2023
@grzesiek2010
Copy link
Member Author

@getodk/testers I've merged this pr to continue work on other related issues please test it on master.

@dbemke
Copy link

dbemke commented May 9, 2023

Tested with Success!

Verified on device with Android 10

Verified cases:

  • changes according to the acceptance criteria described in the issue
  • all auto send options in Collect settings and in form settings
  • saving, finalizing a form in Drafts and Ready to send
  • Form Entry Settings connected with saving and finalizing enabled/disabled
  • saving and sending forms in an encrypted project
  • delete after send enabled/disabled
  • reconfiguring project with QR codes from previous versions with settings „Mark form as finalized” and sending a form, trying to save a draft
  • quit form dialog

@srujner
Copy link

srujner commented May 9, 2023

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
Labels
behavior verified high priority Should be looked at before other PRs/issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refine form saving language
4 participants