Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/models/rb_sprint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
1 change: 1 addition & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,4 @@ ja:
* ステータスはチケットのデフォルトのステータスになります
error_cannot_close_sprint_with_open_stories: "オープン中のストーリーが存在するためストーリーを閉じることができません"
error_task_not_exist: "タスクは既に削除されており、存在しません。"
error_sprint_duration_maximum_three_months: "スプリントの長さは最長3ヶ月までです。"