Skip to content
Merged
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
29 changes: 28 additions & 1 deletion app/models/proposal.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
# frozen_string_literal: true

class Proposal < ApplicationRecord
include Proposal::State
enum :state, {
submitted: 'submitted',
soft_accepted: 'soft accepted',
soft_waitlisted: 'soft waitlisted',
soft_rejected: 'soft rejected',
accepted: 'accepted',
waitlisted: 'waitlisted',
rejected: 'rejected',
withdrawn: 'withdrawn',
not_accepted: 'not accepted'
}, default: :submitted

SOFT_STATES = [:soft_accepted, :soft_waitlisted, :soft_rejected, :submitted].freeze
FINAL_STATES = [:accepted, :waitlisted, :rejected, :withdrawn, :not_accepted].freeze

SOFT_TO_FINAL = {
soft_accepted: :accepted,
soft_rejected: :rejected,
soft_waitlisted: :waitlisted,
submitted: :rejected
}.with_indifferent_access.freeze

BECOMES_PROGRAM_SESSION = [:accepted, :waitlisted].freeze

has_many :public_comments, dependent: :destroy
has_many :internal_comments, dependent: :destroy
Expand Down Expand Up @@ -142,6 +164,11 @@ def decline
program_session.update(state: :declined)
end

# draft? is an alias for submitted?
def draft?
submitted?
end

def finalized?
FINAL_STATES.include?(state.to_sym)
end
Expand Down
34 changes: 0 additions & 34 deletions app/models/proposal/state.rb

This file was deleted.