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
c8bad77f
Commit
c8bad77f
authored
Jan 31, 2018
by
Tugce Nur Tas
Browse files
remove not needed stuff :)
parent
192be216
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/models/group_assignment.rb
View file @
c8bad77f
...
...
@@ -3,7 +3,6 @@ class GroupAssignment < ApplicationRecord
include
GroupAssignmentCommon
after_save
:update_group_offer_search_field
after_update
:save_group_assignment_logs
,
if: :dates_updated?
before_destroy
:create_log_of_self_and_delete_self
has_many
:group_assignment_logs
...
...
@@ -20,10 +19,6 @@ class GroupAssignment < ApplicationRecord
scope
:running
,
(
->
{
no_end
.
have_start
})
def
save_group_assignment_logs
create_log_of_self
(
period_start_before_last_save
,
period_end_before_last_save
)
end
def
termination_verifiable?
ended?
&&
termination_submitted_by
.
present?
end
...
...
@@ -35,7 +30,7 @@ class GroupAssignment < ApplicationRecord
def
create_log_of_self
(
start_date
=
period_start
,
end_date
=
period_end
)
return
false
if
running?
# prevent deleting of running group assignment
GroupAssignmentLog
.
create
!
(
GroupAssignmentLog
.
create
(
attributes
.
except
(
'id'
,
'created_at'
,
'updated_at'
,
'active'
)
.
merge
(
title:
group_offer
.
title
,
group_assignment_id:
id
,
period_start:
start_date
,
period_end:
end_date
)
...
...
@@ -62,20 +57,12 @@ class GroupAssignment < ApplicationRecord
true
end
def
verify_termination
(
user
)
update
(
termination_verified_by:
user
,
termination_verified_at:
Time
.
zone
.
now
)
end
private
def
create_log_of_self_and_delete_self
delete
if
create_log_of_self
end
def
dates_updated?
saved_change_to_period_start?
||
saved_change_to_period_end?
end
def
update_group_offer_search_field
group_offer
.
update_search_volunteers
end
...
...
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