Cht-core: Reports deleted from webapp interface are saved fully hydrated

Created on 19 Nov 2019  路  12Comments  路  Source: medic/cht-core

Describe the bug
Instead of just adding the _deleted flag on the original report json, deleting a report from webapp will result in adding the _deleted flag to the fully hydrated report (patient and contact).

To Reproduce
Steps to reproduce the behavior:

  1. Load Reports tab.
  2. Select a report, and check it's JSON in the DB to verify that it is not hydrated.
  3. Delete the report from webapp (pressing the "Trash can" icon in the action bar)
  4. Load the JSON of the deleted report and verify that the it is now fully hydrated.
    To load the JSON of a deleted doc, you would need to get it's rev and request with /medic/<report_uuid>?rev=<deleted_rev>.
    The rev can be obtained by either:
  5. /_all_docs?keys=["<report_uuid>"] - the value will be result.rows[0].value.rev
  6. /_changes?filter=_doc_ids&doc_ids=["<report_uuid>"] - the value will be result.results[0].changes[0].rev

Expected behavior
The JSON of the deleted report should not be hydrated.

Environment

  • Browser: any
  • App: webapp
  • Version: 3.8
Help wanted 3 - Low Bug

All 12 comments

Not yet started - delaying to 3.9.0

Moved to 3.12.0 to free up engineers to work on 3.11.0.

Ready for AT on 6130-minify-deleted-records.

The original Json and the JSON of the deleted doc seem almost the same with a few lines of difference (but this seems to be the case with master as well). Am I missing something @dianabarsan ?
image

The $$hashKey is a property that Angular adds (as a means to uniquely identify scope objects).
I've never seen it (and I just tried deleting a doc on gamma.dev), but I'm probably not reproducing it correctly.

@njogz would you mind looking into this?

Yes. Looking into it.

I am also unable to reproduce the $$hashKey. @ngaruko could you please provide the steps to reproduce the diff you show above?

@njogz I was using standard configuration - deleted report loaded from test data

@ngaruko the $$hashkey key issue will possibly be resolved with the angular update coming up. Gareth mentions that here

@dianabarsan I am trying to understand what this ticket was supposed to do and make sure we did the right thing. As I see, there seems to be no much difference between the Json of the original report and the Json of the deleted report.
Tested withundo death report and did a file comparison between the two json. Differences as follow (ignoring the _rev of course) -

on master (undo death report)
image

_on branch_ : (patient field removed)
image

As I see, there seems to be no much difference between the Json of the original report and the Json of the deleted report.

This is what the ticket was supposed to do :)

I guess we can merge and close this off @njogz .

Was this page helpful?
0 / 5 - 0 ratings