Commit 8dfbecd2 authored by Jakub Motycka's avatar Jakub Motycka
Browse files

fix: period_end change validation, changing period_end change terminated? so...

fix: period_end change validation, changing period_end change terminated? so it has to be excluded from the check and only termination_verified_by will be used
parent 06af8184
Pipeline #143312 passed with stage
in 11 minutes and 59 seconds
......@@ -37,7 +37,7 @@ class Assignment < ApplicationRecord
validate :period_end_changeable
def period_end_changeable
if terminated? && period_end_changed? && assignment_log
if termination_verified_by.present? && period_end_changed? && assignment_log
errors.add(:base, :period_end_unchangeable)
end
end
......
......@@ -38,7 +38,7 @@ class GroupAssignment < ApplicationRecord
scope :with_unterminated_staffomatic, (-> { left_outer_joins(:group_offer).merge(GroupOffer.with_staffomatic).unterminated })
def period_end_changeable
if terminated? && period_end_changed? && group_assignment_logs.present?
if termination_verified_by.present? && period_end_changed? && group_assignment_logs.present?
errors.add(:base, :period_end_unchangeable)
end
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