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

Pdu-parent #86

Merged
merged 1 commit into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main_rcpch-nhs-organisations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]')
Expand All @@ -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
Expand Up @@ -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
Expand Up @@ -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
Expand Down