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

Add geolocations to group_health endpoint #201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

simfeld
Copy link
Contributor

@simfeld simfeld commented Jul 8, 2021

Closes #195

Comment on lines +69 to +75
# geolocations only exist on Group::Abteilung, thus we can't include geolocations in
# the queries for other group types
abt = Group.from("((#{abteilung})) " \
"AS #{Group.quoted_table_name}")
.page(params[:page]).per(params[:size] || DEFAULT_PAGE_SIZE)
.as_json(only: GROUPS_FIELDS))
.as_json(only: GROUPS_FIELDS,
include: { geolocations: { only: GEOLOCATIONS_FIELDS } })
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I first tried to include geolocations in the existing abt_and_below query, but this gave me errors in as_json with include: { geolocations: ... } because the geolocations property only exists for Group::Abteilung. If there's a better way to achieve this than concatenation of two queries I'm happy to adapt it.

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.

GroupHealth-Erweiterung um Treffpunkte
1 participant