diff --git a/app/models/rb_sprint.rb b/app/models/rb_sprint.rb index 4a010f1a6..7ffd1cf16 100644 --- a/app/models/rb_sprint.rb +++ b/app/models/rb_sprint.rb @@ -4,11 +4,16 @@ class RbSprint < Version unloadable validate :start_and_end_dates + validate :duration_3months def start_and_end_dates errors.add(:base, I18n.t("error_sprint_end_before_start")) if self.effective_date && self.sprint_start_date && self.sprint_start_date >= self.effective_date end + def duration_3months + errors.add(:base, I18n.t('error_sprint_duration_maximum_three_months')) if self.effective_date && self.sprint_start_date && self.effective_date > self.sprint_start_date + 3.months + end + scope :open_sprints, lambda { |project| open_or_locked.by_date.in_project(project) } scope :closed_sprints, lambda { |project| closed.by_date.in_project(project) } diff --git a/config/locales/en.yml b/config/locales/en.yml index 847f13af4..784046ab4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -228,3 +228,4 @@ en: * State will be set to the default issue state error_cannot_close_sprint_with_open_stories: "Cannot close a sprint while it still has open stories." error_task_not_exist: "This task has already been deleted and no longer exists." + error_sprint_duration_maximum_three_months: "The maximum duration of a sprint is 3 months." diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 85db63b03..5eeadb0db 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -230,3 +230,4 @@ ja: * ステータスはチケットのデフォルトのステータスになります error_cannot_close_sprint_with_open_stories: "オープン中のストーリーが存在するためストーリーを閉じることができません" error_task_not_exist: "タスクは既に削除されており、存在しません。" + error_sprint_duration_maximum_three_months: "スプリントの長さは最長3ヶ月までです。"