Commit c8bad77f authored by Tugce Nur Tas's avatar Tugce Nur Tas
Browse files

remove not needed stuff :)

parent 192be216
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment