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

tweak(adminPanel): RN-1419: Don't delete survey screens and components on import unless they have changed #5885

Merged
merged 7 commits into from
Nov 22, 2024

Conversation

alexd-bes
Copy link
Contributor

Issue RN-1419: Don't delete survey screens and components on import unless they have changed

Changes:

  • Updated importSurveyQuestions to only update relevant fields in the survey screen component
  • It will delete the screens and recreate if the question or has changed or questions are added/removed

@@ -23,10 +23,16 @@ import {
SURVEY_METADATA,
} from './processSurveyMetadata';
import { caseAndSpaceInsensitiveEquals, convertCellToJson } from './utilities';
import { RECORDS } from '@tupaia/database';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import { RECORDS } from '@tupaia/database';

const objectsAreEqual = (a, b) => {
if (!!a === !!b) return true;
return JSON.stringify(a) === JSON.stringify(b);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this function is always going to be correct. I would probably just outsource this to lodash isEqual here since we need to do a deep equality check?! Or if you update the function it would probably be good to add a unit test for it

Screenshot 2024-09-12 at 3 23 58 PM

Copy link
Contributor

@tcaiger tcaiger left a comment

Choose a reason for hiding this comment

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

Everything it looking good apart from the object equality check

merge: update branch with latest dev
@tcaiger tcaiger merged commit ec216e2 into dev Nov 22, 2024
44 checks passed
@tcaiger tcaiger deleted the rn-1419-survey-importing branch November 22, 2024 01:50
tcaiger added a commit that referenced this pull request Nov 24, 2024
* mobile survey header

* custom icons

* Update SurveyMobilePaginator.tsx

* wip

* fix(tupaiaWeb): RN-1512: Fix broken arithmetic visuals (#5980)

Update utils.ts

* survey select page

* country selector

* side menu

* db(entityTypes): MAUI-4763: Add new entity types (pacmossi_insecticide_test) for PacMOSSI project (#5986)

* pacmossi_insecticide_test entity type

* schema and model update

* copy and share

* header style

* Update dataTables.js

* sticky header

* tweak styles

* style tweaks

* Update ResultsList.tsx

* refactor list

* select list

* mobile menu

* toast styles

* fix(datatrak): RN-1450: Fix mobile tooltips (#5971)

* Update Tooltip.tsx

* set delay on BaseTooltip

---------

Co-authored-by: Andrew <[email protected]>

* Update index.ts

* tweaks

* pr suggestions

* Update CancelConfirmModal.tsx

* tweak(datatrak): RN-1451: DataTrak request country access form (#6000)

Update RequestCountryAccessForm.tsx

* tweak(adminPanel): RN-1419: Don't delete survey screens and components on import unless they have changed (#5885)

* Working check

* Handle object equality with stringify

* Fix object equality check

* Remove console log

---------

Co-authored-by: Andrew <[email protected]>

* Update SurveyDisplayName.tsx

---------

Co-authored-by: Salman <[email protected]>
Co-authored-by: Andrew <[email protected]>
Co-authored-by: alexd-bes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants