SORMAS-Foundation / SORMAS-Project

SORMAS (Surveillance, Outbreak Response Management and Analysis System) is an early warning and management system to fight the spread of infectious diseases.
https://sormas.org
GNU General Public License v3.0
293 stars 143 forks source link

Don't overwrite case classification when users bulk-edit both disease and classification simultaneously #11930

Open adinaflorea9 opened 1 year ago

adinaflorea9 commented 1 year ago

Problem Description

When editing cases through bulk edit mode, the case classification of the selected cases is not updated for all of them. The issue seems to be reproducible randomly and I could not yet have a very clear set of steps under which this can be reproduced every time. It seems that once the cases are edited through bulk edit mode, then the update is done for all of them ne second time.

I could reproduce this on my local machine and also on @sergiupacurariu 's local machine.

Reproduction Steps

  1. Open the 'Case directory' and enter bulk edit mode;
  2. Select some cases (any number from 30/50 upwards) that have different values for case classification, disease, outcome and investigation status;
  3. From 'Bulk actions' select 'Edit';
  4. Edit every one of the possible values in the form - change disease - EVD; change case classification - Suspect case; change investigation status - done; change case outcome - recovered; change facility - select any hospital that you have;
  5. Click 'Save';
  6. In the 'Infrastructure data has changed' pop-up select 'Transfer cases';
  7. Observe the list of cases that were selected for the bulk edit and check the 'Case classification' of all of them.

Actual behavior: the disease, outcome of case, investigation status and facility have been updated for all of the cases; the case classification has not been updated for part of them (for me out of 200 cases selected for 50 the case classification was not updated).

Expected Behavior

The 'Case classification' should be updated for all of the selected cases.

Affected Area(s)

Web app

SORMAS Version

1.84.0

Android version/Browser

Chrome

User Role(s)

Admin+NatUser

Server URL

local machine

Additional Information

No response

MateStrysewske commented 1 year ago

I would guess that this is caused by the simultaneous change of disease and classification at the same time; because this can lead to the system classification (i.e. the automatically calculated classification) changing, and that then leads to the case classification being re-calculated after the case is saved. You can test this out by attempting to do the same bulk change that you just did, but with the automatic case classification feature turned off (you have to edit the sormas.properties file for that and restart the server). If my assumption is correct, all cases should be updated as expected then.

adinaflorea9 commented 1 year ago

@MateStrysewske @sergiupacurariu I tried Mate's suggestion from the comment above and the 'Case classification' is updated accordingly for all the cases that I selected in bulk edit mode if the automatic case classification is turned off.

MateStrysewske commented 1 year ago

A solution could be to skip the automatic classification when the user has edited the case classification; this is easy to figure out because we have a boolean parameter that tells us whether the user has updated the case classification or not. However, I think this should involve some refactoring because I'd like to not just add another parameter to the save methods; we should rather introduce a new class, e.g. called "CaseSaveParameters", that contains information such as this one and the already existing syncShares parameter.

Since I don't think it's likely that people will bulk-edit the disease and classification of cases at the same time, I don't think it's important to do this right now.