summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-12 09:58:38 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-12 09:58:38 +0000
commit3c8e7c79b639d32ecd6c8cb81b20fce00a6e722d (patch)
tree5615009119c5fd3d2d935f04defc75c721d5eb34
parent3be226d0c475359bf9061b4577b7efada397dd0d (diff)
downloadredmine-3c8e7c79b639d32ecd6c8cb81b20fce00a6e722d.tar.gz
redmine-3c8e7c79b639d32ecd6c8cb81b20fce00a6e722d.zip
Overdue versions (date reached and open issues > 0) are now always displayed on the roadmap.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@604 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/projects_controller.rb4
-rw-r--r--app/models/version.rb16
-rw-r--r--app/views/projects/roadmap.rhtml2
-rw-r--r--lang/bg.yml1
-rw-r--r--lang/de.yml1
-rw-r--r--lang/en.yml1
-rw-r--r--lang/es.yml1
-rw-r--r--lang/fr.yml1
-rw-r--r--lang/it.yml1
-rw-r--r--lang/ja.yml1
-rw-r--r--lang/nl.yml1
-rw-r--r--lang/pt-br.yml1
-rw-r--r--lang/pt.yml1
-rw-r--r--lang/sv.yml1
-rw-r--r--lang/zh.yml1
15 files changed, 31 insertions, 3 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 3a77bcc9e..2341bf0a0 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -443,8 +443,8 @@ class ProjectsController < ApplicationController
def roadmap
@trackers = Tracker.find(:all, :conditions => ["is_in_roadmap=?", true], :order => 'position')
retrieve_selected_tracker_ids(@trackers)
- conditions = ("1" == params[:completed] ? nil : [ "#{Version.table_name}.effective_date > ? OR #{Version.table_name}.effective_date IS NULL", Date.today])
- @versions = @project.versions.find(:all, :conditions => conditions).sort
+ @versions = @project.versions.sort
+ @versions = @versions.select {|v| !v.completed? } unless params[:completed]
end
def activity
diff --git a/app/models/version.rb b/app/models/version.rb
index f4a40da67..bc58e0de4 100644
--- a/app/models/version.rb
+++ b/app/models/version.rb
@@ -34,8 +34,22 @@ class Version < ActiveRecord::Base
effective_date
end
+ # Returns true if the version is completed: due date reached and no open issues
def completed?
- effective_date && effective_date <= Date.today
+ effective_date && (effective_date <= Date.today) && (open_issues_count == 0)
+ end
+
+ # Returns true if the version is overdue: due date reached and some open issues
+ def overdue?
+ effective_date && (effective_date < Date.today) && (open_issues_count > 0)
+ end
+
+ def open_issues_count
+ @open_issues_count ||= Issue.count(:all, :conditions => ["fixed_version_id = ? AND is_closed = ?", self.id, false], :include => :status)
+ end
+
+ def closed_issues_count
+ @closed_issues_count ||= Issue.count(:all, :conditions => ["fixed_version_id = ? AND is_closed = ?", self.id, true], :include => :status)
end
def wiki_page
diff --git a/app/views/projects/roadmap.rhtml b/app/views/projects/roadmap.rhtml
index 8c7d460de..9a3ec685f 100644
--- a/app/views/projects/roadmap.rhtml
+++ b/app/views/projects/roadmap.rhtml
@@ -18,6 +18,8 @@
<a name="<%= version.name %>"><h3 class="icon22 icon22-package"><%= version.name %></h3></a>
<% if version.completed? %>
<p><%= format_date(version.effective_date) %></p>
+ <% elsif version.overdue? %>
+ <p><strong><%= l(:label_roadmap_overdue, distance_of_time_in_words(Time.now, version.effective_date)) %> (<%= format_date(version.effective_date) %>)</strong></p>
<% elsif version.effective_date %>
<p><strong><%=l(:label_roadmap_due_in)%> <%= distance_of_time_in_words Time.now, version.effective_date %> (<%= format_date(version.effective_date) %>)</strong></p>
<% end %>
diff --git a/lang/bg.yml b/lang/bg.yml
index 9fd8b3705..1c7b5e4a9 100644
--- a/lang/bg.yml
+++ b/lang/bg.yml
@@ -339,6 +339,7 @@ label_sort_lower: Премести по-долу
label_sort_lowest: Премести най-долу
label_roadmap: Пътна карта
label_roadmap_due_in: Излиза след
+label_roadmap_overdue: %s late
label_roadmap_no_issues: Няма задачи за тази версия
label_search: Търсене
label_result: %d резултат
diff --git a/lang/de.yml b/lang/de.yml
index 2e7522ce8..e1e5a2c4f 100644
--- a/lang/de.yml
+++ b/lang/de.yml
@@ -339,6 +339,7 @@ label_sort_lower: eins tiefer
label_sort_lowest: Ende
label_roadmap: Roadmap
label_roadmap_due_in: Fällig in
+label_roadmap_overdue: %s late
label_roadmap_no_issues: Keine Tickets für diese Version
label_search: Suche
label_result: %d Resultat
diff --git a/lang/en.yml b/lang/en.yml
index 16647afae..7f77eca3d 100644
--- a/lang/en.yml
+++ b/lang/en.yml
@@ -339,6 +339,7 @@ label_sort_lower: Move down
label_sort_lowest: Move to bottom
label_roadmap: Roadmap
label_roadmap_due_in: Due in
+label_roadmap_overdue: %s late
label_roadmap_no_issues: No issues for this version
label_search: Search
label_result: %d result
diff --git a/lang/es.yml b/lang/es.yml
index d866b8297..a6e068af5 100644
--- a/lang/es.yml
+++ b/lang/es.yml
@@ -339,6 +339,7 @@ label_sort_lower: Bajar
label_sort_lowest: Último
label_roadmap: Roadmap
label_roadmap_due_in: Due in
+label_roadmap_overdue: %s late
label_roadmap_no_issues: No issues for this version
label_search: Búsqueda
label_result: %d resultado
diff --git a/lang/fr.yml b/lang/fr.yml
index 788ec2b56..86cc9cead 100644
--- a/lang/fr.yml
+++ b/lang/fr.yml
@@ -339,6 +339,7 @@ label_sort_lower: Descendre
label_sort_lowest: Descendre en dernier
label_roadmap: Roadmap
label_roadmap_due_in: Echéance dans
+label_roadmap_overdue: En retard de %s
label_roadmap_no_issues: Aucune demande pour cette version
label_search: Recherche
label_result: %d résultat
diff --git a/lang/it.yml b/lang/it.yml
index 74f1c1eaf..1bc6dccbf 100644
--- a/lang/it.yml
+++ b/lang/it.yml
@@ -339,6 +339,7 @@ label_sort_lower: Giù
label_sort_lowest: Sposta in fondo
label_roadmap: Roadmap
label_roadmap_due_in: Da ultimare in
+label_roadmap_overdue: %s late
label_roadmap_no_issues: Nessun contesto per questa versione
label_search: Ricerca
label_result: %d risultato
diff --git a/lang/ja.yml b/lang/ja.yml
index 216e176e8..b5fc4845c 100644
--- a/lang/ja.yml
+++ b/lang/ja.yml
@@ -340,6 +340,7 @@ label_sort_lower: 下へ
label_sort_lowest: 一番下へ
label_roadmap: ロードマップ
label_roadmap_due_in: 期日まで
+label_roadmap_overdue: %s late
label_roadmap_no_issues: このバージョンに向けての問題はありません
label_search: 検索
label_result: %d件の結果
diff --git a/lang/nl.yml b/lang/nl.yml
index a71c496b0..4e221ce2e 100644
--- a/lang/nl.yml
+++ b/lang/nl.yml
@@ -339,6 +339,7 @@ label_sort_lower: Verplaats naar beneden
label_sort_lowest: Verplaats naar eind
label_roadmap: Roadmap
label_roadmap_due_in: Due in
+label_roadmap_overdue: %s late
label_roadmap_no_issues: Geen issues voor deze versie
label_search: Zoeken
label_result: %d resultaat
diff --git a/lang/pt-br.yml b/lang/pt-br.yml
index 21d08d059..c43903665 100644
--- a/lang/pt-br.yml
+++ b/lang/pt-br.yml
@@ -339,6 +339,7 @@ label_sort_lower: Mover para baixo
label_sort_lowest: Mover para o fim
label_roadmap: Roadmap
label_roadmap_due_in: Due in
+label_roadmap_overdue: %s late
label_roadmap_no_issues: Sem tarefas para essa versao
label_search: Busca
label_result: %d resultado
diff --git a/lang/pt.yml b/lang/pt.yml
index 2c1fe9f17..8c7d2cf71 100644
--- a/lang/pt.yml
+++ b/lang/pt.yml
@@ -339,6 +339,7 @@ label_sort_lower: Mover para baixo
label_sort_lowest: Mover para o fim
label_roadmap: Roadmap
label_roadmap_due_in: Termina em
+label_roadmap_overdue: %s late
label_roadmap_no_issues: Sem tarefas para essa versão
label_search: Busca
label_result: %d resultado
diff --git a/lang/sv.yml b/lang/sv.yml
index 4f0003698..e18f824c8 100644
--- a/lang/sv.yml
+++ b/lang/sv.yml
@@ -339,6 +339,7 @@ label_sort_lower: Flytta ner
label_sort_lowest: Flytta till botten
label_roadmap: Roadmap
label_roadmap_due_in: Färdig om
+label_roadmap_overdue: %s late
label_roadmap_no_issues: Inga brister för denna version
label_search: Sök
label_result: %d resultat
diff --git a/lang/zh.yml b/lang/zh.yml
index 88dfdca44..2af952552 100644
--- a/lang/zh.yml
+++ b/lang/zh.yml
@@ -342,6 +342,7 @@ label_sort_lower: 下移
label_sort_lowest: 置底
label_roadmap: 路线图
label_roadmap_due_in: Due in
+label_roadmap_overdue: %s late
label_roadmap_no_issues: 该版本没有任务
label_search: 查找
label_result: %d 个结果