getodk / collect

ODK Collect is an Android app for filling out forms. It's been used to collect billions of data points in challenging environments around the world. Contribute and make the world a better place! ✨📋✨
https://docs.getodk.org/collect-intro
Other
718 stars 1.38k forks source link

Unable to delete submission of softly deleted form without version #4004

Closed kkrawczyk123 closed 4 years ago

kkrawczyk123 commented 4 years ago

Software and hardware versions

Collect v1.28.x, Android v5-7-10.x, device used...

Problem description

Testing result from #3992 scenario from #3961 is failing:

Given there's a form definition formID/version combination that has been soft deleted When I visit Delete Saved Form And I delete the last Saved Form corresponding to that formID/version combination That form definition formID/version combination's files and database entry should be fully deleted

Steps to reproduce the problem

  1. Download form ex. from Drive or copy to form folder manually
  2. Fill submission of the form
  3. Choose match exactly server in Form management (with default server or any other that doesn't have that specific form.
  4. Go to fill blank form - see that form is softly deleted
  5. Go to form folder - form is visible
  6. Go to Delete Saved Form and try to remove submission - submission fails to delete - toast is visible. The form is still not fully deleted. The other thing is that Delete Selected button becomes disabled when saved form to delete is selected.
  7. The form is still not fully deleted when I choose to delete saved forms in reset application. The form is fully deleted only after selecting blank forms in reset application.

gif of example attached: deletesub

Expected behavior

Other information

Things you tried, stack traces, related issues, suggestions on how to fix it...

seadowg commented 4 years ago

@kkrawczyk123 I wrote a test to try and reproduce and it passed:

testDependencies.server.addForm("Two Question", "two_question", "two-question.xml");

rule.mainMenu()
                .startBlankForm("One Question")
                .answerQuestion("what is your age", "30")
                .swipeToEndScreen()
                .clickSaveAndExit()
                .setServer(testDependencies.server.getURL())
                .enableMatchExactly()
                .clickFillBlankForm()
                .clickRefresh()
                .pressBack(new MainMenuPage(rule))
                .clickDeleteSavedForm()
                .clickForm("One Question")
                .clickDeleteSelected(1)
                .clickDeleteForms()
                .pressBack(new MainMenuPage(rule))
                .assertNumberOfFinalizedForms(0);

Is there anything about this that seems different from the steps you took? This is definitely happening on master for you?

kkrawczyk123 commented 4 years ago

I have just tried manually for both your forms, one question.xml and two questions.xml and what is totally weird I am able to delete one form question submission but not two question submission. Yes, it is happening on master. I am not sure if it's important but I was testing it after storage migration, not on odk folder.

seadowg commented 4 years ago

@kkrawczyk123 do you run into the same problems when just deleting the form from the 'Blank Forms' tab? I just want to simplify the repro steps as I'm not convinced it has anything to do with Match Exactly.

kkrawczyk123 commented 4 years ago

@seadowg I have investigated deeper and you should be able to reproduce by steps:

  1. Download form from Google Drive or Central
  2. Fill submission
  3. Try to delete the submission

It is not strictly connected to match exactly as we both initially thought but it is still a serious regression issue. It is also not reproducible for forms and submission downloaded from the Aggregate server what makes it that tricky. I have checked store version - the issue does not occur at all. I have also tried on the last commit before all your recent changes 9f92513ef740ab384987de4536f01ac28005e1f2 and issue is not visible.

seadowg commented 4 years ago

@kkrawczyk123 hmmm very strange. I'll investigate further. I'm thinking it's also not happening for forms copied over during tests which is why I wasn't seeing it.

seadowg commented 4 years ago

@kkrawczyk123 I'm still unable to reproduce with those steps (I used Central and the one-question.xml form). Are you seeing it no matter what form? Could you maybe share the forms you are seeing the problem with?

kkrawczyk123 commented 4 years ago

@seadowg exactly, I have tried with random forms and reproduced in each try. I am deleting Saved Form mean submission not blank form if it's confusing.

seadowg commented 4 years ago

@kkrawczyk123 I'm doing the same steps it just wasn't broken for me! I think I might have got it though: the one-question.xml has an orx:version (so a form version) whereas the two-question.xml does not. I noticed you were having problems with two-question so I gave that a go, and I was finally able to reproduce.

So, I'm guessing it's forms without a version that are failing to delete! Would you be able to double-check the forms you tried to see if that makes sense? I'll start working on a fix assuming that's the problem.

kkrawczyk123 commented 4 years ago

@seadowg yes, it makes total sense now! I've just tried with All widgets with specified form version from Google Drive and I am able to delete submission. Sorry, I have closed it accidentally XD

kkrawczyk123 commented 4 years ago

testing note: when testing the fix check delete after send option and auto delete defined in the form.