Allow re-inclusion of previously-deleted orphan codes - #3209
Open
Jongmassey wants to merge 1 commit into
Open
Conversation
Jongmassey
force-pushed
the
Jongmassey/fix-empty-uploaded
branch
from
August 19, 2026 12:43
3480480 to
e3fe9be
Compare
An "orphan" code (one without a related search) will be deleted from the draft codelistversion by `update_code_statuses` if it is not the descendant of an included code but will still be present in the UI until the point a user refreshes the page or saves the draft. They may then chose to re-include this orphan code, at which point the UI will show the code as included but since the code had previously been deleted then it will not be included in the db state This commit allows for previously-deleted orphan codes to be re-included if the user requests so. Any descendants of the re-included code are also implicitly re-included.
Jongmassey
force-pushed
the
Jongmassey/fix-empty-uploaded
branch
from
August 19, 2026 12:44
e3fe9be to
e2bcf83
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3206
Orphan codes are codes without related searches. This may be because the search whence they came has been deleted or because the codelist was originally created by upload of a csv file.
Orphan codes that are not either themselves included or descendants of an included code are deleted to avoid a broken state (see #2639 ). However, the UI is not immediately synchronised with the db state after this deletion and so they persist in the UI.
A user may then request inclusion of these deleted-in-the-db-but-persisting-in-the-ui codes which would then show them as included in the UI but they would still be missing from the db. Upon saving the codelist, these codes and their descendants would disappear from view, in some cases leaving completely empty codelists (see #3206 ).
This PR ensures that any request for inclusion of codes is honoured in the db such that what the user sees in the builder view is what they will get when they click save.