-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
deck-scrubbingTech debt or other between-initiative tidy-up workTech debt or other between-initiative tidy-up work
Description
Why are we doing this?
There are situations where attempting to convert a BNF codelist to DM+D results in a 500 server error. If an identical dmd codelist already exists the code should display a banner to the end user with a link to the dmd file. However the code that attempts to get the link fails if there are multiple identical slugs (which can happen as they're only unique to a user or an org).
How will we know when it's done?
The conversion no longer returns an error but instead displays the banner linking back to the existing dmd codelist
What are we doing?
This line fails if there are multiple identical slugs:
| dmd_codelist = Handle.objects.get(slug=f"{version.codelist.slug}-dmd").codelist |
Instead we should scope it to the user or org, similar (but not identical) to this code here:
opencodelists/codelists/actions.py
Lines 760 to 763 in 877690d
| owner_query = Q(user=owner) if isinstance(owner, User) else Q(organisation=owner) | |
| existing_handle = Handle.objects.filter( | |
| owner_query & (Q(name=dmd_name) | Q(slug=dmd_slug)) | |
| ).last() |
Metadata
Metadata
Assignees
Labels
deck-scrubbingTech debt or other between-initiative tidy-up workTech debt or other between-initiative tidy-up work