app/models/unidom/accession/concerns/as_post_fulfilled.rb in unidom-accession-2.3.4 vs app/models/unidom/accession/concerns/as_post_fulfilled.rb in unidom-accession-2.3.5
- old
+ new
@@ -15,27 +15,29 @@
# 让当前岗位在指定时间 at 开始被指定的参与者 by 履行。指定时间缺省为当前时间。如:
# post.is_fulfilled_as_post! by: tom
# 或者
# post.is_fulfilled_as_post! by: tom, at: Time.now
def is_fulfilled_as_post!(by: nil, at: Time.now)
+
assert_present! :by, by
assert_present! :at, at
- #raise ArgumentError.new('The by argument is required.') if by.blank?
- #raise ArgumentError.new('The at argument is required.') if at.blank?
+
post_fulfillments.create! fulfiller: by, opened_at: at
+
end
##
# 判断当前岗位在指定时间 at 是否被指定的参与者 by 履行。指定时间缺省为当前时间。如:
# post.is_fulfilled_as_post? by: tom
# 或者
# post.is_fulfilled_as_post? by: tom, at: Time.now
def is_fulfilled_as_post?(by: nil, at: Time.now)
+
assert_present! :by, by
assert_present! :at, at
- #raise ArgumentError.new('The by argument is required.') if by.blank?
- #raise ArgumentError.new('The at argument is required.') if at.blank?
+
post_fulfillments.fulfilled_by(by).valid_at(now: at).exists?
+
end
end
module ClassMethods