Commit 2ffea883 authored by Eric Davis's avatar Eric Davis

[#279] Add an optional Start Date to Versions

parent 85e1333e
......@@ -42,8 +42,12 @@ class Version < ActiveRecord::Base
user.allowed_to?(:view_issues, self.project)
end
# When a version started.
#
# Can either be a set date stored in the database or a dynamic one
# based on the earlist start_date of the fixed_issues
def start_date
@start_date ||= fixed_issues.minimum('start_date')
@start_date ||= (read_attribute(:start_date) || fixed_issues.minimum('start_date'))
end
def due_date
......
......@@ -2,6 +2,7 @@
<table class="list versions">
<thead><tr>
<th><%= l(:label_version) %></th>
<th><%= l(:field_start_date) %></th>
<th><%= l(:field_effective_date) %></th>
<th><%= l(:field_description) %></th>
<th><%= l(:field_status) %></th>
......@@ -13,6 +14,7 @@
<% for version in @project.shared_versions.sort %>
<tr class="version <%= cycle 'odd', 'even' %> <%=h version.status %> <%= 'shared' if version.project != @project %>">
<td class="name"><%= link_to_version version %></td>
<td class="date"><%= format_date(version.start_date) %></td>
<td class="date"><%= format_date(version.effective_date) %></td>
<td class="description"><%=h version.description %></td>
<td class="status"><%= l("version_status_#{version.status}") %></td>
......
......@@ -5,6 +5,7 @@
<p><%= f.text_field :description, :size => 60 %></p>
<p><%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %></p>
<p><%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %></p>
<p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('version_start_date') %></p>
<p><%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
<p><%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %></p>
......
<% if version.completed? %>
<p><%= format_date(version.effective_date) %></p>
<% elsif version.effective_date %>
<p><strong><%= due_date_distance_in_words(version.effective_date) %></strong> (<%= format_date(version.effective_date) %>)</p>
<p>
<%= l(:field_start_date) %> <%= h(format_date(version.start_date)) %>
<%= l(:field_due_date) %> <%= h(format_date(version.due_date)) %>
</p>
<% if !version.completed? && version.due_date %>
<p><strong><%= due_date_distance_in_words(version.effective_date) %></strong></p>
<% end %>
<p><%=h version.description %></p>
......
......@@ -252,7 +252,6 @@ bg:
field_admin: Администратор
field_last_login_on: Последно свързване
field_language: Език
field_effective_date: Дата
field_password: Парола
field_new_password: Нова парола
field_password_confirmation: Потвърждение
......
......@@ -241,7 +241,6 @@ bs:
field_admin: Administrator
field_last_login_on: Posljednja konekcija
field_language: Jezik
field_effective_date: Datum
field_password: Lozinka
field_new_password: Nova lozinka
field_password_confirmation: Potvrda
......
......@@ -253,7 +253,6 @@ ca:
field_admin: Administrador
field_last_login_on: Última connexió
field_language: Idioma
field_effective_date: Data
field_password: Contrasenya
field_new_password: Contrasenya nova
field_password_confirmation: Confirmació
......
......@@ -226,7 +226,6 @@ cs:
field_admin: Administrátor
field_last_login_on: Poslední přihlášení
field_language: Jazyk
field_effective_date: Datum
field_password: Heslo
field_new_password: Nové heslo
field_password_confirmation: Potvrzení
......
......@@ -239,7 +239,6 @@ da:
field_admin: Administrator
field_last_login_on: Sidste forbindelse
field_language: Sprog
field_effective_date: Dato
field_password: Kodeord
field_new_password: Nyt kodeord
field_password_confirmation: Bekræft
......
......@@ -267,7 +267,6 @@ de:
field_admin: Administrator
field_last_login_on: Letzte Anmeldung
field_language: Sprache
field_effective_date: Datum
field_password: Kennwort
field_new_password: Neues Kennwort
field_password_confirmation: Bestätigung
......
......@@ -236,7 +236,6 @@ el:
field_admin: Διαχειριστής
field_last_login_on: Τελευταία σύνδεση
field_language: Γλώσσα
field_effective_date: Ημερομηνία
field_password: Κωδικός πρόσβασης
field_new_password: Νέος κωδικός πρόσβασης
field_password_confirmation: Επιβεβαίωση
......
......@@ -246,7 +246,7 @@ en-GB:
field_admin: Administrator
field_last_login_on: Last connection
field_language: Language
field_effective_date: Date
field_effective_date: Due date
field_password: Password
field_new_password: New password
field_password_confirmation: Confirmation
......
......@@ -252,7 +252,7 @@ en:
field_admin: Administrator
field_last_login_on: Last connection
field_language: Language
field_effective_date: Date
field_effective_date: Due date
field_password: Password
field_new_password: New password
field_password_confirmation: Confirmation
......
......@@ -269,7 +269,6 @@ es:
field_done_ratio: % Realizado
field_downloads: Descargas
field_due_date: Fecha fin
field_effective_date: Fecha
field_estimated_hours: Tiempo estimado
field_field_format: Formato
field_filename: Fichero
......
......@@ -246,7 +246,6 @@ eu:
field_admin: Kudeatzailea
field_last_login_on: Azken konexioa
field_language: Hizkuntza
field_effective_date: Data
field_password: Pasahitza
field_new_password: Pasahitz berria
field_password_confirmation: Berrespena
......
......@@ -247,7 +247,6 @@ fi:
field_admin: Ylläpitäjä
field_last_login_on: Viimeinen yhteys
field_language: Kieli
field_effective_date: Päivä
field_password: Salasana
field_new_password: Uusi salasana
field_password_confirmation: Vahvistus
......
......@@ -259,7 +259,6 @@ fr:
field_admin: Administrateur
field_last_login_on: "Dernière connexion "
field_language: Langue
field_effective_date: Date
field_password: Mot de passe
field_new_password: Nouveau mot de passe
field_password_confirmation: Confirmation
......
......@@ -246,7 +246,6 @@ gl:
field_done_ratio: % Realizado
field_downloads: Descargas
field_due_date: Data fin
field_effective_date: Data
field_estimated_hours: Tempo estimado
field_field_format: Formato
field_filename: Arquivo
......
......@@ -255,7 +255,6 @@ he:
field_admin: ניהול
field_last_login_on: התחברות אחרונה
field_language: שפה
field_effective_date: תאריך
field_password: סיסמה
field_new_password: סיסמה חדשה
field_password_confirmation: אישור
......
......@@ -242,7 +242,6 @@ hr:
field_admin: Administrator
field_last_login_on: Zadnja prijava
field_language: Primarni jezik
field_effective_date: Datum
field_password: Zaporka
field_new_password: Nova zaporka
field_password_confirmation: Potvrda zaporke
......
......@@ -245,7 +245,6 @@
field_admin: Adminisztrátor
field_last_login_on: Utolsó bejelentkezés
field_language: Nyelv
field_effective_date: Dátum
field_password: Jelszó
field_new_password: Új jelszó
field_password_confirmation: Megerősítés
......
......@@ -240,7 +240,6 @@ id:
field_admin: Administrator
field_last_login_on: Terakhir login
field_language: Bahasa
field_effective_date: Tanggal
field_password: Kata sandi
field_new_password: Kata sandi baru
field_password_confirmation: Konfirmasi
......
......@@ -218,7 +218,6 @@ it:
field_admin: Amministratore
field_last_login_on: Ultima connessione
field_language: Lingua
field_effective_date: Data
field_password: Password
field_new_password: Nuova password
field_password_confirmation: Conferma
......
......@@ -274,7 +274,6 @@ ja:
field_admin: 管理者
field_last_login_on: 最終接続日
field_language: 言語
field_effective_date: 期日
field_password: パスワード
field_new_password: 新しいパスワード
field_password_confirmation: パスワードの確認
......
......@@ -284,7 +284,6 @@ ko:
field_admin: 관리자
field_last_login_on: 마지막 로그인
field_language: 언어
field_effective_date: 일자
field_password: 비밀번호
field_new_password: 새 비밀번호
field_password_confirmation: 비밀번호 확인
......
......@@ -295,7 +295,6 @@ lt:
field_admin: Administratorius
field_last_login_on: Paskutinis ryšys
field_language: Kalba
field_effective_date: Data
field_password: Slaptažodis
field_new_password: Naujas slaptažodis
field_password_confirmation: Patvirtinimas
......
......@@ -237,7 +237,6 @@ lv:
field_admin: Administrators
field_last_login_on: Pēdējo reizi pieslēdzies
field_language: Valoda
field_effective_date: Datums
field_password: Parole
field_new_password: Janā parole
field_password_confirmation: Paroles apstiprinājums
......
......@@ -250,7 +250,6 @@ mk:
field_admin: Администратор
field_last_login_on: Последна најава
field_language: Јазик
field_effective_date: Дата
field_password: Лозинка
field_new_password: Нова лозинка
field_password_confirmation: Потврда
......
......@@ -241,7 +241,6 @@ mn:
field_admin: Администратор
field_last_login_on: Сүүлийн холбоо
field_language: Хэл
field_effective_date: Огноо
field_password: Нууц үг
field_new_password: Шннэ нууц үг
field_password_confirmation: Баталгаажуулах
......
......@@ -216,7 +216,6 @@ nl:
field_done_ratio: % Gereed
field_downloads: Downloads
field_due_date: Verwachte datum gereed
field_effective_date: Datum
field_estimated_hours: Geschatte tijd
field_field_format: Formaat
field_filename: Bestand
......
......@@ -216,7 +216,6 @@
field_admin: Administrator
field_last_login_on: Sist innlogget
field_language: Språk
field_effective_date: Dato
field_password: Passord
field_new_password: Nytt passord
field_password_confirmation: Bekreft passord
......
......@@ -233,7 +233,6 @@ pl:
field_done_ratio: % Wykonane
field_downloads: Pobrań
field_due_date: Data oddania
field_effective_date: Data
field_estimated_hours: Szacowany czas
field_field_format: Format
field_filename: Plik
......
......@@ -249,7 +249,6 @@ pt-BR:
field_admin: Administrador
field_last_login_on: Última conexão
field_language: Idioma
field_effective_date: Data
field_password: Senha
field_new_password: Nova senha
field_password_confirmation: Confirmação
......
......@@ -234,7 +234,6 @@ pt:
field_admin: Administrador
field_last_login_on: Última visita
field_language: Língua
field_effective_date: Data
field_password: Palavra-chave
field_new_password: Nova palavra-chave
field_password_confirmation: Confirmação
......
......@@ -221,7 +221,6 @@ ro:
field_admin: Administrator
field_last_login_on: Ultima autentificare în
field_language: Limba
field_effective_date: Data
field_password: Parola
field_new_password: Parola nouă
field_password_confirmation: Confirmare
......
......@@ -317,7 +317,6 @@ ru:
field_downloads: Загрузки
field_due_date: Дата выполнения
field_editable: Редактируемый
field_effective_date: Дата
field_estimated_hours: Оцененное время
field_field_format: Формат
field_filename: Файл
......
......@@ -220,7 +220,6 @@ sk:
field_admin: Administrátor
field_last_login_on: Posledné prihlásenie
field_language: Jazyk
field_effective_date: Dátum
field_password: Heslo
field_new_password: Nové heslo
field_password_confirmation: Potvrdenie
......
......@@ -225,7 +225,6 @@ sl:
field_admin: Administrator
field_last_login_on: Zadnjič povezan(a)
field_language: Jezik
field_effective_date: Datum
field_password: Geslo
field_new_password: Novo geslo
field_password_confirmation: Potrditev
......
......@@ -250,7 +250,6 @@ sr-YU:
field_admin: Administrator
field_last_login_on: Poslednje povezivanje
field_language: Jezik
field_effective_date: Datum
field_password: Lozinka
field_new_password: Nova lozinka
field_password_confirmation: Potvrda lozinke
......
......@@ -250,7 +250,6 @@ sr:
field_admin: Администратор
field_last_login_on: Последње повезивање
field_language: Језик
field_effective_date: Датум
field_password: Лозинка
field_new_password: Нова лозинка
field_password_confirmation: Потврда лозинке
......
......@@ -294,7 +294,6 @@ sv:
field_admin: Administratör
field_last_login_on: Senaste inloggning
field_language: Språk
field_effective_date: Datum
field_password: Lösenord
field_new_password: Nytt lösenord
field_password_confirmation: Bekräfta lösenord
......
......@@ -222,7 +222,6 @@ th:
field_admin: ผู้บริหารจัดการ
field_last_login_on: เข้าระบบครั้งสุดท้าย
field_language: ภาษา
field_effective_date: วันที่
field_password: รหัสผ่าน
field_new_password: รหัสผ่านใหม่
field_password_confirmation: ยืนยันรหัสผ่าน
......
......@@ -245,7 +245,6 @@ tr:
field_admin: Yönetici
field_last_login_on: Son Bağlantı
field_language: Dil
field_effective_date: Tarih
field_password: Parola
field_new_password: Yeni Parola
field_password_confirmation: Onay
......
......@@ -216,7 +216,6 @@ uk:
field_admin: Адміністратор
field_last_login_on: Останнє підключення
field_language: Мова
field_effective_date: Дата
field_password: Пароль
field_new_password: Новий пароль
field_password_confirmation: Підтвердження
......
......@@ -279,7 +279,6 @@ vi:
field_admin: Quản trị
field_last_login_on: Kết nối cuối
field_language: Ngôn ngữ
field_effective_date: Ngày
field_password: Mật mã
field_new_password: Mật mã mới
field_password_confirmation: Khẳng định lại
......
......@@ -334,7 +334,6 @@
field_admin: 管理者
field_last_login_on: 最近連線日期
field_language: 語系
field_effective_date: 日期
field_password: 目前密碼
field_new_password: 新密碼
field_password_confirmation: 確認新密碼
......
......@@ -257,7 +257,6 @@ zh:
field_admin: 管理员
field_last_login_on: 最后登录
field_language: 语言
field_effective_date: 日期
field_password: 密码
field_new_password: 新密码
field_password_confirmation: 确认
......
class AddStartDateToVersions < ActiveRecord::Migration
def self.up
add_column :versions, :start_date, :date
end
def self.down
remove_column :versions, :start_date
end
end
......@@ -35,6 +35,31 @@ class VersionTest < ActiveSupport::TestCase
assert_equal I18n.translate('activerecord.errors.messages.not_a_date'), v.errors.on(:effective_date)
end
context "#start_date" do
context "with no value saved" do
should "be the date of the earlist issue" do
project = Project.find(1)
v = Version.create!(:project => project, :name => 'Progress')
add_issue(v, :estimated_hours => 10, :start_date => '2010-03-01')
Issue.generate_for_project!(project, :subject => 'not assigned', :start_date => '2010-01-01')
assert_equal '2010-03-01', v.start_date.to_s
end
end
context "with a value saved" do
should "be the value" do
project = Project.find(1)
v = Version.create!(:project => project, :name => 'Progress', :start_date => '2010-01-05')
add_issue(v, :estimated_hours => 10, :start_date => '2010-03-01')
assert_equal '2010-01-05', v.start_date.to_s
end
end
end
def test_progress_should_be_0_with_no_assigned_issues
project = Project.find(1)
v = Version.create!(:project => project, :name => 'Progress')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment