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

fix: group offer terminated scope and terminated? method

- scope was querying for non existent field
- method was validating nonexistent attribute
parent b43e09f3
......@@ -70,6 +70,8 @@ class GroupOffer < ApplicationRecord
date_between_inclusion(:period_end, start_date, end_date)
}
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
......@@ -78,6 +80,10 @@ class GroupOffer < ApplicationRecord
group_assignments.have_start.any? || group_assignment_logs.any?
end
def terminated?
period_end_set_by.present?
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