Skip to content

Commit

Permalink
Merge pull request #86 from rcpch:pdu-parent
Browse files Browse the repository at this point in the history
Pdu-parent
eatyourpeas authored Feb 1, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 6e19fed + a280f9c commit 5d10aea
Showing 3 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main_rcpch-nhs-organisations.yml
Original file line number Diff line number Diff line change
@@ -55,15 +55,15 @@ jobs:
- name: Build MkDocs site
env:
SITE_DIR: staticdocs
SITE_DIR: site
DOCS_URL: https://rcpch.github.io/rcpch-nhs-organisations/
run: mkdocs build --config-file documentation/mkdocs.yml

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: staticdocs
publish_dir: site

deploy-mkdocs-only:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, '[docs]')
@@ -83,12 +83,12 @@ jobs:
- name: Build MkDocs site
env:
SITE_DIR: staticdocs
SITE_DIR: site
DOCS_URL: https://rcpch.github.io/rcpch-nhs-organisations/
run: mkdocs build --config-file documentation/mkdocs.yml

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: staticdocs
publish_dir: site
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,5 +5,6 @@ staticfiles
staticdocs
envs/.env
logs
documentation/site

.DS_Store
8 changes: 7 additions & 1 deletion rcpch_nhs_organisations/hospitals/serializers/trust.py
Original file line number Diff line number Diff line change
@@ -97,11 +97,17 @@ class Meta:
]

def get_parent(self, obj):
# there are deprecated PDUs that don't have an organisation
try:
pdu = PaediatricDiabetesUnit.objects.get(pz_code=obj.pz_code)
except PaediatricDiabetesUnit.DoesNotExist:
return None

try:
# all related organisations for that PaediatricDiabetesUnit should have the same parent
# so we can just get the first one
organisation = Organisation.objects.filter(
paediatric_diabetes_unit=obj
paediatric_diabetes_unit=pdu
).first()
except Organisation.DoesNotExist:
return None

0 comments on commit 5d10aea

Please sign in to comment.