Skip to content
Snippets Groups Projects
Verified Commit 9c8d88bb authored by Stan Hu's avatar Stan Hu
Browse files

Fix import/export of iteration cadences

!95372 added
support for import/export of iteration cadences, but the
`start_date_would_not_create_past_iteration` validation fails once
enough time elapsed from the present day.

Since we're doing a project import/export, there's no guarantee that
these date validations will be correct given the current date, so just
skip them.

Relates to #371462

Changelog: fixed
EE: true
parent ce353a7c
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ module Iterations
class Cadence < ApplicationRecord
include Gitlab::SQL::Pattern
include EachBatch
include Importable
self.table_name = 'iterations_cadences'
......@@ -25,9 +26,9 @@ class Cadence < ApplicationRecord
before_validation :reset_automation_params, if: :converted_to_manual?
validate :start_date_comes_later_than_current_iteration, if: -> { current_iteration && requires_new_automation_start_date? }
validate :start_date_comes_later_than_past_iteration, if: -> { !current_iteration && requires_new_automation_start_date? }
validate :start_date_would_not_create_past_iteration, if: -> { !current_iteration && requires_new_automation_start_date? }
validate :start_date_comes_later_than_current_iteration, if: -> { !importing && current_iteration && requires_new_automation_start_date? }
validate :start_date_comes_later_than_past_iteration, if: -> { !importing && !current_iteration && requires_new_automation_start_date? }
validate :start_date_would_not_create_past_iteration, if: -> { !importing && !current_iteration && requires_new_automation_start_date? }
after_commit :ensure_iterations_in_advance, on: [:create, :update], if: :changed_iterations_automation_fields?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment