-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Remove grace period restriction time restriction from editing finalized forms #5717
Conversation
@@ -1215,5 +1215,5 @@ | |||
<string name="view_form">View</string> | |||
<string name="close_snackbar">Close snackbar</string> | |||
|
|||
<string name="edit_finalized_form_warning">After September 30th, you will not be able to edit finalized forms. Save forms as draft to edit them later.\n\nYou can check for errors in a draft form by tapping the three dots (⋮) and then Check for errors.</string> | |||
<string name="edit_finalized_form_warning">In later releases, you will not be able to edit finalized forms. Save forms as draft to edit them later.\n\nYou can check for errors in a draft form by tapping the three dots (⋮) and then Check for errors.</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan this message. Any ideas for a better one @lognaturel?
@@ -4,14 +4,12 @@ import org.odk.collect.forms.instances.Instance | |||
import org.odk.collect.settings.SettingsProvider | |||
import org.odk.collect.settings.keys.ProtectedProjectKeys | |||
|
|||
const val OCTOBER_1st_2023_UTC = 1696118400000 | |||
|
|||
fun Instance.canBeEdited(settingsProvider: SettingsProvider): Boolean { | |||
return this.status == Instance.STATUS_INCOMPLETE && | |||
settingsProvider.getProtectedSettings().getBoolean(ProtectedProjectKeys.KEY_EDIT_SAVED) | |||
} | |||
|
|||
fun Instance.canBeEditedWithGracePeriod(settingsProvider: SettingsProvider): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be renamed or even merged with the one above.
Problem descriptionA finalized form can be saved as a draft again when accessed via Ready to send. Afterwards for a moment it’s possible to send the form or edit it again from Ready to send (while it’s really a draft). Steps to reproduce the problem
Other informationThe issue also occurs in the v2023.2.3. In the master version 602cac5 editing finalized forms is not allowed so the issue is impossible to reproduce. |
When a finalized form is edited via Ready to send it’s possible to tap Save as draft in the exit dialog. The changes are saved but the form stays in Ready to send. Steps to reproduce the problem
Other informationThe issue also occurs in the v2023.2.3. |
The first issue is fixed. The second issue is still present but I don't know if the form should be moved from Ready to send to draft in that case. |
After editing a finalized form the subtext in Ready to send is a bit misleading. The subtext shows the date and time when the form was finalized. Steps to reproduce:
The changes are saved but the subtext isn’t changed (Finalized with the date and time of the first finalization). If you enter the form and tap the device back button, in the exit dialog there is information that the form was saved/edited and the new date and time is present. |
I don't think either of these are critical, but they do make everything confusing. It seems like both are consequence of a hangover of the old world where finalisation was less "final". When you hit the new "Save as draft" button on the end screen, Collect explicitly saves the form as a draft (the "incomplete" status) whereas for the floppy disk and the "Save as draft" button in the quit dialog, it will save the form as finalised if the form is already finalised. This hadn't really come up before, because it doesn't matter if you can't edit finalized forms (and the weirdness must have been missed the first time we added the grace period). I think that we should remove the extra "intelligence" on the floppy/quit dialog save buttons and just have them always save the form as a draft leaving the only way to save a finalised form and keep it finalised is to hit "Finalize" itself. This introduces a bit of disruption to people that edit finalized forms and then immediately send them as they'll have to actually hit "Finalize", but I think the current situation allows for very mixed messaging as you're able "Save as draft" and then immediately send. I think the only alternative (other than keeping the current behaviour), would be to add an extra "Finalize" button to the quit dialog and I'm not sure how we'd deal with the floppy button. I'll go ahead and make the change and we can revert if it's not something that we're agreed upon (cc @grzesiek2010 and @lognaturel)
I don't think we'll want to add a specific piece of text for quitting a form that was finalised as we're still going to be taking the ability to edit a finalised form away later. "Last saved" isn't innaccuracte so I think it's ok for the moment. I think making the changes I've suggest above should make the scenario less confusing. |
@dbemke I've made changes as described! |
@@ -1035,7 +1034,7 @@ public boolean onOptionsItemSelected(MenuItem item) { | |||
|
|||
case R.id.menu_save: | |||
// don't exit | |||
saveForm(false, InstancesDaoHelper.isInstanceComplete(getFormController()), null, true); | |||
saveForm(false, false, null, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a super easy change as the tests already describe the desired behaviour. I just had to get rid of the extra untested logic
to me, that solution would be ok. Still confusing a little bit but it is what it is I would rather avoid adding new buttons for finalization. |
After the fix forms are moved to Drafts. The only thing is the scenario below (save button + discard changes) in which after those steps the user is moved to Ready to send view and the form is still there (for a moment before going back to the main menu - like in the first issue) and it's possible to send it (although it's a draft). Steps to reproduce:
|
Good find! Not sure why we end up on "Ready to send" instead of the Main Menu there, but will fix that. |
@dbemke that should be fixed now! |
Tested with Success! Verified on device with Android 10 Verified cases:
|
Tested with Success! Verified on device with Android 13 |
As discussed. We're removing the restriction entirely from v2023.2 and v2023.3 and disabling editing of finalised forms again in v2023.4.
What has been done to verify that this works as intended?
Modified existing tests.
Why is this the best possible solution? Were any other approaches considered?
Not a lot to discuss here. I just removed clauses that restricted the grace period to a specific time window from the code.
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?
Most important thing to check here is that finalized forms can be edited from "Ready to send" and that there's no references to that going way after a certain point in time (but that it'll go away in a later release).
Before submitting this PR, please make sure you have:
./gradlew checkAll
and confirmed all checks still pass OR confirm CircleCI build passes and run./gradlew connectedDebugAndroidTest
locally.