-
Notifications
You must be signed in to change notification settings - Fork 26
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
PEOPLE: Geschwister in Abteilung als computed value #289
Conversation
@@ -20,10 +20,18 @@ def roles_grouped | |||
end | |||
end | |||
|
|||
def siblings_in_context(context) | |||
family_member_finder.family_members_in_context(context, kind: :sibling) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ich habe die Logik in einen abgekapselten Service verschoben, weil sie doch an einigen verschiedenen Orten gebraucht wird und so einfacher getestet werden kann.
ebfac4c
to
a1e49ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logik sieht solide aus, merci vielmals! Habe nur sehr kleine stilistische Änderungen. Ich teste es dann mal noch bei Gelegenheit von Hand durch, wir könnens eh erst ab dem 17. Oktober mergen.
def family_members_in_layer(group, kind: :sibling) | ||
Role.joins(person: :family_members) | ||
.where(group: group.groups_in_same_layer, | ||
person: { family_members: { kind: kind, other: person } }) | ||
end | ||
|
||
def family_members_in_event(event, kind: :sibling) | ||
Event::Participation.joins(person: :family_members) | ||
.where(person: { family_members: { kind: kind, other: person } }, | ||
event: event) | ||
end | ||
|
||
def family_members_in_context(context, kind: :sibling) | ||
case context | ||
when Event | ||
family_members_in_event(context, kind: kind) | ||
when Group | ||
family_members_in_layer(context, kind: kind) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation ist hier zwei Spaces zu weit gerutscht
Co-authored-by: Carlo Beltrame <[email protected]>
bee82ff
to
16e03cf
Compare
Nice merci! Hab noch die Indentation gefixt und rebased :) |
#hitobito#2147