Browse Source

Enable collection window validation (#1567)

pull/1573/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
1cd8c01841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/models/validations/setup_validations.rb
  2. 4
      app/services/feature_toggle.rb

2
app/models/validations/setup_validations.rb

@ -3,7 +3,7 @@ module Validations::SetupValidations
include CollectionTimeHelper
def validate_startdate_setup(record)
return unless record.startdate && date_valid?("startdate", record) && FeatureToggle.startdate_collection_window_validation_enabled?
return unless record.startdate && date_valid?("startdate", record)
unless record.startdate.between?(active_collection_start_date, current_collection_end_date)
record.errors.add :startdate, startdate_validation_error_message

4
app/services/feature_toggle.rb

@ -4,10 +4,6 @@ class FeatureToggle
Rails.env.production? || Rails.env.test? || Rails.env.staging?
end
def self.startdate_collection_window_validation_enabled?
Rails.env.production? || Rails.env.test?
end
def self.startdate_two_week_validation_enabled?
Rails.env.production? || Rails.env.test? || Rails.env.staging?
end

Loading…
Cancel
Save