Browse Source

introduce pending status

pull/1503/head
Phil Lee 3 years ago
parent
commit
29a1dec269
  1. 12
      app/models/lettings_log.rb
  2. 7
      app/models/log.rb
  3. 8
      app/models/sales_log.rb

12
app/models/lettings_log.rb

@ -115,18 +115,6 @@ class LettingsLog < Log
end end
end end
def completed?
status == "completed"
end
def not_started?
status == "not_started"
end
def in_progress?
status == "in_progress"
end
def weekly_net_income def weekly_net_income
return unless earnings && incfreq return unless earnings && incfreq

7
app/models/log.rb

@ -8,7 +8,12 @@ class Log < ApplicationRecord
before_save :update_status! before_save :update_status!
STATUS = { "not_started" => 0, "in_progress" => 1, "completed" => 2 }.freeze STATUS = {
"not_started" => 0,
"in_progress" => 1,
"completed" => 2,
"pending" => 3,
}.freeze
enum status: STATUS enum status: STATUS
scope :filter_by_status, ->(status, _user = nil) { where status: } scope :filter_by_status, ->(status, _user = nil) { where status: }

8
app/models/sales_log.rb

@ -104,14 +104,6 @@ class SalesLog < Log
collection_start_year < 2023 collection_start_year < 2023
end end
def not_started?
status == "not_started"
end
def completed?
status == "completed"
end
def setup_completed? def setup_completed?
form.setup_sections.all? { |sections| sections.subsections.all? { |subsection| subsection.status(self) == :completed } } form.setup_sections.all? { |sections| sections.subsections.all? { |subsection| subsection.status(self) == :completed } }
end end

Loading…
Cancel
Save