Skip to content

Commit

Permalink
rubocop fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alishaevn committed Jul 28, 2023
1 parent 1f979dc commit 4b5b054
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/hyrax/transactions/steps/save.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def initialize(persister: Hyrax.persister, publisher: Hyrax.publisher)
# @return [Dry::Monads::Result] `Success(work)` if the change_set is
# applied and the resource is saved;
# `Failure([#to_s, change_set.resource])`, otherwise.
# rubocop:disable Metrics/MethodLength
def call(change_set, user: nil)
begin
valid_future_date?(change_set.lease, 'lease_expiration_date') if change_set.lease
Expand All @@ -51,13 +52,13 @@ def call(change_set, user: nil)
publish_changes(resource: saved, user: user, new: unsaved.new_record, new_collections: new_collections)
Success(saved)
end
# rubocop:disable Metrics/MethodLength

def valid_future_date?(item, attribute)
raise StandardError.new 'Must be a future date' if item.fields[attribute] < Time.zone.now
raise StandardError, "#{item.model} must use a future date" if item.fields[attribute] < Time.zone.now
end

def save_leases_and_embargoes(unsaved)
binding.pry
if unsaved.embargo.present?
unsaved.embargo.embargo_release_date = unsaved.embargo.embargo_release_date&.to_datetime
unsaved.embargo = @persister.save(resource: unsaved.embargo)
Expand Down

0 comments on commit 4b5b054

Please sign in to comment.