From 29a1dec2698d715cfdb534d9ce1486a60fd38dac Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Fri, 31 Mar 2023 10:24:24 +0100 Subject: [PATCH] introduce pending status --- app/models/lettings_log.rb | 12 ------------ app/models/log.rb | 7 ++++++- app/models/sales_log.rb | 8 -------- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index f96c41c88..4a0651a29 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -115,18 +115,6 @@ class LettingsLog < Log 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 return unless earnings && incfreq diff --git a/app/models/log.rb b/app/models/log.rb index 407ec2746..a1adac589 100644 --- a/app/models/log.rb +++ b/app/models/log.rb @@ -8,7 +8,12 @@ class Log < ApplicationRecord 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 scope :filter_by_status, ->(status, _user = nil) { where status: } diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index 1cfa91acb..b0aed712a 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -104,14 +104,6 @@ class SalesLog < Log collection_start_year < 2023 end - def not_started? - status == "not_started" - end - - def completed? - status == "completed" - end - def setup_completed? form.setup_sections.all? { |sections| sections.subsections.all? { |subsection| subsection.status(self) == :completed } } end