Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
aoz-003
Commits
eae50efd
Verified
Commit
eae50efd
authored
Jan 30, 2018
by
Kaspar Vollenweider
👻
Browse files
fix rubocop complaining about too long lines
parent
7e8d4a21
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/controllers/group_assignments_controller.rb
View file @
eae50efd
...
...
@@ -60,7 +60,7 @@ class GroupAssignmentsController < ApplicationController
def
terminate
;
end
def
update_terminated_at
@group_assignment
.
volunteer
.
waive
=
group_assignment_params
[
:volunteer_attributes
][
:waive
]
==
'1'
@group_assignment
.
volunteer
.
waive
=
waive_param_true?
@group_assignment
.
assign_attributes
(
group_assignment_params
.
except
(
:volunteer_attributes
)
.
merge
(
termination_submitted_at:
Time
.
zone
.
now
,
termination_submitted_by:
current_user
))
if
@group_assignment
.
save
&&
terminate_reminder_mailing
...
...
@@ -79,6 +79,10 @@ class GroupAssignmentsController < ApplicationController
private
def
waive_param_true?
group_assignment_params
[
:volunteer_attributes
][
:waive
]
==
'1'
end
def
terminate_reminder_mailing
ReminderMailingVolunteer
.
termination_for
(
@group_assignment
).
map
do
|
rmv
|
rmv
.
mark_process_submitted
(
current_user
,
terminate_parent_mailing:
true
)
...
...
app/controllers/group_offers_controller.rb
View file @
eae50efd
...
...
@@ -82,7 +82,8 @@ class GroupOffersController < ApplicationController
end
def
submit_initiate_termination
if
@group_offer
.
update
(
period_end:
group_offer_params
[
:period_end
],
period_end_set_by:
current_user
)
if
@group_offer
.
update
(
period_end:
group_offer_params
[
:period_end
],
period_end_set_by:
current_user
)
redirect_to
group_offers_path
,
notice:
'Gruppenangebots beendigung erfolgreich eingeleitet.'
else
render
:initiate_termination
...
...
@@ -96,7 +97,8 @@ class GroupOffersController < ApplicationController
period_end_set_by:
current_user
)
end
redirect_to
initiate_termination_group_offer_path
(
@group_offer
),
notice:
'Gruppeneinsätze wurden beendet.'
redirect_to
initiate_termination_group_offer_path
(
@group_offer
),
notice:
'Gruppeneinsätze wurden beendet.'
end
private
...
...
@@ -135,10 +137,12 @@ class GroupOffersController < ApplicationController
end
def
group_offer_params
params
.
require
(
:group_offer
).
permit
(
:title
,
:offer_type
,
:offer_state
,
:volunteer_state
,
:necessary_volunteers
,
:description
,
:women
,
:men
,
:children
,
:teenagers
,
:unaccompanied
,
:all
,
:long_term
,
:regular
,
:short_term
,
:workday
,
:weekend
,
:morning
,
:afternoon
,
:evening
,
:flexible
,
:schedule_details
,
:department_id
,
:creator_id
,
:organization
,
:location
,
:period_end
,
:group_offer_category_id
,
group_assignments_attributes
)
params
.
require
(
:group_offer
).
permit
(
:title
,
:offer_type
,
:offer_state
,
:volunteer_state
,
:necessary_volunteers
,
:description
,
:women
,
:men
,
:children
,
:teenagers
,
:unaccompanied
,
:all
,
:long_term
,
:regular
,
:short_term
,
:workday
,
:weekend
,
:morning
,
:afternoon
,
:evening
,
:flexible
,
:schedule_details
,
:department_id
,
:creator_id
,
:organization
,
:location
,
:period_end
,
:group_offer_category_id
,
group_assignments_attributes
)
end
end
test/models/group_offer_validation_test.rb
View file @
eae50efd
...
...
@@ -5,7 +5,7 @@ class GroupOfferValidationTest < ActiveSupport::TestCase
group_offer
=
create
:group_offer
group_assignment1
=
create
:group_assignment
,
period_start:
1
.
year
.
ago
,
period_end:
nil
,
group_offer:
group_offer
group_assignment2
=
create
:group_assignment
,
period_start:
6
.
months
.
ago
,
period_end:
nil
,
create
:group_assignment
,
period_start:
6
.
months
.
ago
,
period_end:
nil
,
group_offer:
group_offer
group_offer
.
period_end
=
Time
.
zone
.
now
refute
group_offer
.
valid?
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment