diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 3a77bcc9..2341bf0a 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 f4a40da6..bc58e0de 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 8c7d460d..9a3ec685 100644 --- a/app/views/projects/roadmap.rhtml +++ b/app/views/projects/roadmap.rhtml @@ -18,6 +18,8 @@

<%= version.name %>

<% if version.completed? %>

<%= format_date(version.effective_date) %>

+ <% elsif version.overdue? %> +

<%= l(:label_roadmap_overdue, distance_of_time_in_words(Time.now, version.effective_date)) %> (<%= format_date(version.effective_date) %>)

<% elsif version.effective_date %>

<%=l(:label_roadmap_due_in)%> <%= distance_of_time_in_words Time.now, version.effective_date %> (<%= format_date(version.effective_date) %>)

<% end %> diff --git a/lang/bg.yml b/lang/bg.yml index 9fd8b370..1c7b5e4a 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 2e7522ce..e1e5a2c4 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 16647afa..7f77eca3 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 d866b829..a6e068af 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 788ec2b5..86cc9cea 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 74f1c1ea..1bc6dccb 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 216e176e..b5fc4845 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 a71c496b..4e221ce2 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 21d08d05..c4390366 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 2c1fe9f1..8c7d2cf7 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 4f000369..e18f824c 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 88dfdca4..2af95255 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 个结果