Browse Source

lint fixes

pull/683/head
Dushan Despotovic 3 years ago
parent
commit
33db47d6f4
  1. 2
      app/models/case_log.rb
  2. 4
      app/models/validations/date_validations.rb

2
app/models/case_log.rb

@ -35,7 +35,7 @@ class CaseLog < ApplicationRecord
belongs_to :owning_organisation, class_name: "Organisation", optional: true belongs_to :owning_organisation, class_name: "Organisation", optional: true
belongs_to :managing_organisation, class_name: "Organisation", optional: true belongs_to :managing_organisation, class_name: "Organisation", optional: true
belongs_to :created_by, class_name: "User", optional: true belongs_to :created_by, class_name: "User", optional: true
belongs_to :scheme, required: false belongs_to :scheme, optional: true
scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org).or(where(managing_organisation: org)) } scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org).or(where(managing_organisation: org)) }
scope :filter_by_status, ->(status, _user = nil) { where status: } scope :filter_by_status, ->(status, _user = nil) { where status: }

4
app/models/validations/date_validations.rb

@ -43,13 +43,11 @@ module Validations::DateValidations
if record.scheme_id.present? if record.scheme_id.present?
scheme_end_date = Scheme.find(record.scheme_id).end_date scheme_end_date = Scheme.find(record.scheme_id).end_date
if scheme_end_date.present? if scheme_end_date.present? && (record.startdate > scheme_end_date)
if record.startdate > scheme_end_date
record.errors.add :startdate, I18n.t("validations.setup.startdate.before_scheme_end_date") record.errors.add :startdate, I18n.t("validations.setup.startdate.before_scheme_end_date")
end end
end end
end end
end
def validate_sale_completion_date(record) def validate_sale_completion_date(record)
date_valid?("sale_completion_date", record) date_valid?("sale_completion_date", record)

Loading…
Cancel
Save