Skip to content

Commit

Permalink
Fix membership config fields for ortsgruppe in groups api
Browse files Browse the repository at this point in the history
  • Loading branch information
codez authored Dec 19, 2024
1 parent aa7671d commit c3f188c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/models/group/ortsgruppe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ class Group::Ortsgruppe < Group
mounted_attr :mitglied_termination_by_section_only, :boolean, default: false, null: false

has_many :sac_section_membership_configs, dependent: :destroy, foreign_key: :group_id

def active_sac_section_membership_config
@active_sac_section_membership_config ||= sac_section_membership_configs.active
end
end
4 changes: 2 additions & 2 deletions app/resources/sac_cas/group_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ module SacCas::GroupResource
attr = [prefix, suffix].join("_")

extra_attribute attr.to_sym, :big_decimal, writable: false, sortable: false do
next unless @object.respond_to?(:sac_section_membership_configs)
@object.active_sac_section_membership_config.send(attr)
next unless @object.respond_to?(:active_sac_section_membership_config)
@object.active_sac_section_membership_config&.send(attr)
end
end
end
Expand Down

0 comments on commit c3f188c

Please sign in to comment.