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

fix: Update data dimension items as part of cat opt combo merge [DHIS2-18321] #19687

Merged
merged 4 commits into from
Jan 16, 2025

Conversation

david-mackessy
Copy link
Contributor

@david-mackessy david-mackessy commented Jan 16, 2025

Problem

Luckily, while Jason P was testing some merge scenarios, he stumbled across this error when trying to merge 2 COCs in the SL DB (KPP63zJPkOu, TDb5JyDQqho).
Object could not be deleted because it is associated with another object: DataDimensionItem

Cause

After looking into this, it seems that a DataElementOperand is also a DataDimensionItem. Although the DataElementOperand is updated as part of the merge, this change is not reflected in the datadimensionitem table even though it is the same DataElementOperand :(

The DataDimensionItem type does not have a CategoryOptionCombo property which is how this was missed originally.

Fix

The datadimensionitem table needs to be updated also as part of the merge.

Testing

Automated

E2E test updated so that data dimension items are persisted, which also need updating

Manual

Using this payload failed before the fix, and passes now
POST /api/categoryOptionCombos/merge

{
    "sources": [
        "KPP63zJPkOu"
    ],
    "target": "TDb5JyDQqho",
    "deleteSources": true,
    "dataMergeStrategy": "LAST_UPDATED"
}

Copy link
Contributor

@jbee jbee left a comment

Choose a reason for hiding this comment

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

The EmbeddedObject did strike again.

@david-mackessy david-mackessy merged commit 4e7da2e into master Jan 16, 2025
17 checks passed
@david-mackessy david-mackessy deleted the DHIS2-18321-update branch January 16, 2025 12:52
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