-
Notifications
You must be signed in to change notification settings - Fork 19
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 export to education view #28
base: master
Are you sure you want to change the base?
Conversation
def event_participations | ||
today = Time.zone.today | ||
entry.event_participations. | ||
select do |p| | ||
p.event.supports_applications? && | ||
p.event.dates.sort_by(&:start_at).last.start_at >= today | ||
end. | ||
collect do |p| | ||
p.event.name | ||
end. | ||
join(', ') | ||
end | ||
|
||
def qualifications | ||
entry.qualifications. | ||
select(&:reactivateable?). | ||
sort_by(&:start_at). | ||
reverse. | ||
uniq(&:qualification_kind). | ||
collect do |q| | ||
"#{q.qualification_kind.label}".strip | ||
end. | ||
join(', ') | ||
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.
It's not great that this logic is duplicated in large parts from the helper to here.
Maybe you could add the common part of the logic to the Youth::PersonDecorator
(e.g. as methods education_event_participations
etc.), and then use that here and in the helper.
Either entry.education_event_participations.join(', ')
or entry.decorate.education_event_participations.join(', ')
should work.
-# or later. See the COPYING file at the top-level directory or at | ||
-# https://github.com/hitobito/hitobito_youth. | ||
|
||
= action_button(t('.export_people'), educations_path({format: :csv}.merge(params.to_unsafe_h)), :download) |
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.
You added the capability for CSV and XLSX to the controller, but only expose CSV here. Wouldn't XLSX be more valuable? Maybe in the future we might want to color some of the text in the spreadsheet, depending on when some qualifications expire.
The CSV is clearly easier to test though.
@@ -0,0 +1,6 @@ | |||
-# Copyright (c) 2023 , Pfadibewegung Schweiz. This file is part of |
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.
-# Copyright (c) 2023 , Pfadibewegung Schweiz. This file is part of | |
-# Copyright (c) 2023, Pfadibewegung Schweiz. This file is part of |
CSV Export der Ausbildungs-Ansicht