Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/purpose.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Purpose < ApplicationRecord

before_validation :set_default_barcode_prefix

validates :name, format: { with: /\A\w[\s\w.-]+\w\z/i }, presence: true, uniqueness: { case_sensitive: false }
validates :name, format: { with: %r{\A\w[\s\w.\-/]+\w\z}i }, presence: true, uniqueness: { case_sensitive: false }

# NOTE: We should validate against valid asset subclasses, but running into some issues with
# subclass loading while seeding.
Expand Down
7 changes: 6 additions & 1 deletion app/models/transfer_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class TransferRequest < ApplicationRecord # rubocop:todo Metrics/ClassLength
# as being more concise as it has fewer states.
state :pending, initial: true
state :started
state :processed
state :processed_1
state :processed_2
state :processed_3
Expand All @@ -85,6 +86,10 @@ class TransferRequest < ApplicationRecord # rubocop:todo Metrics/ClassLength
transitions to: :started, from: [:pending], after: :on_started
end

event :progress do
transitions to: :processed, from: [:started], after: :on_started
end

event :process_1 do
transitions to: :processed_1, from: [:pending], after: :on_started
end
Expand All @@ -104,7 +109,7 @@ class TransferRequest < ApplicationRecord # rubocop:todo Metrics/ClassLength
event :pass do
# Jumping straight to passed moves through an implied started state.
transitions to: :passed, from: :pending, after: :on_started
transitions to: :passed, from: %i[started failed processed_2 processed_3 processed_4]
transitions to: :passed, from: %i[started failed processed processed_2 processed_3 processed_4]
end

event :fail do
Expand Down
Loading