Verified Commit d7f6daec authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

group germinated scope and methods in model

parent 2f7b0cdb
......@@ -73,10 +73,6 @@ class GroupOffer < ApplicationRecord
scope :terminated, (-> { field_not_nil(:period_end_set_by) })
def active_group_assignments_between?(start_date, end_date)
group_assignments.active_between(start_date, end_date).any?
end
def terminatable?
group_assignments.have_start.any? || group_assignment_logs.any?
end
......@@ -85,6 +81,10 @@ class GroupOffer < ApplicationRecord
period_end_set_by.present?
end
def active_group_assignments_between?(start_date, end_date)
group_assignments.active_between(start_date, end_date).any?
end
def all_group_assignments_ended_within?(start_date, end_date)
ended_within = group_assignments.end_within(start_date, end_date).ids
not_end_before = group_assignments.end_after(end_date).ids
......
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