diff --git a/app/controllers/case_logs_controller.rb b/app/controllers/case_logs_controller.rb index 2a0c6b84a..f3753058e 100644 --- a/app/controllers/case_logs_controller.rb +++ b/app/controllers/case_logs_controller.rb @@ -3,8 +3,8 @@ class CaseLogsController < ApplicationController before_action :authenticate, if: :json_api_request? def index - @completed_case_logs = CaseLog.where(status: 2) - @in_progress_case_logs = CaseLog.where(status: 1) + @completed_case_logs = CaseLog.completed + @in_progress_case_logs = CaseLog.in_progress end def create diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 64c1cdb95..42a020fd4 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -28,6 +28,8 @@ end class CaseLog < ApplicationRecord include Discard::Model default_scope -> { kept } + scope :in_progress, -> { where(status: "in_progress") } + scope :completed, -> { where(status: "completed") } validate :instance_validations before_save :update_status!