@@ -44,7 +44,8 module VersionsHelper | |||
|
44 | 44 | rescue ActiveRecord::RecordNotFound |
|
45 | 45 | # When grouping by an association, Rails throws this exception if there's no result (bug) |
|
46 | 46 | end |
|
47 | counts = h.keys.compact.sort.collect {|k| {:group => k, :total => h[k][0], :open => h[k][1], :closed => (h[k][0] - h[k][1])}} | |
|
47 | # Sort with nil keys in last position | |
|
48 | counts = h.keys.sort {|a,b| a.nil? ? 1 : (b.nil? ? -1 : a <=> b)}.collect {|k| {:group => k, :total => h[k][0], :open => h[k][1], :closed => (h[k][0] - h[k][1])}} | |
|
48 | 49 | max = counts.collect {|c| c[:total]}.max |
|
49 | 50 | |
|
50 | 51 | render :partial => 'issue_counts', :locals => {:version => version, :criteria => criteria, :counts => counts, :max => max} |
@@ -14,12 +14,11 | |||
|
14 | 14 | <% counts.each do |count| %> |
|
15 | 15 | <tr> |
|
16 | 16 | <td width="130px" align="right" > |
|
17 | <%= link_to h(count[:group]), {:controller => 'issues', | |
|
18 | :action => 'index', | |
|
19 | :project_id => version.project, | |
|
20 | :set_filter => 1, | |
|
21 | :status_id => '*', | |
|
22 | :fixed_version_id => version}.merge("#{criteria}_id".to_sym => count[:group]) %> | |
|
17 | <% if count[:group] -%> | |
|
18 | <%= link_to(h(count[:group]), project_issues_path(version.project, :set_filter => 1, :status_id => '*', :fixed_version_id => version, "#{criteria}_id" => count[:group])) %> | |
|
19 | <% else -%> | |
|
20 | <%= link_to(l(:label_none), project_issues_path(version.project, :set_filter => 1, :status_id => '*', :fixed_version_id => version, "#{criteria}_id" => "!*")) %> | |
|
21 | <% end %> | |
|
23 | 22 | </td> |
|
24 | 23 | <td width="240px"> |
|
25 | 24 | <%= progress_bar((count[:closed].to_f / count[:total])*100, |
@@ -22,7 +22,7 require 'versions_controller' | |||
|
22 | 22 | class VersionsController; def rescue_action(e) raise e end; end |
|
23 | 23 | |
|
24 | 24 | class VersionsControllerTest < ActionController::TestCase |
|
25 | fixtures :projects, :versions, :issues, :users, :roles, :members, :member_roles, :enabled_modules, :issue_statuses | |
|
25 | fixtures :projects, :versions, :issues, :users, :roles, :members, :member_roles, :enabled_modules, :issue_statuses, :issue_categories | |
|
26 | 26 | |
|
27 | 27 | def setup |
|
28 | 28 | @controller = VersionsController.new |
@@ -103,6 +103,19 class VersionsControllerTest < ActionController::TestCase | |||
|
103 | 103 | assert_tag :tag => 'h2', :content => /1.0/ |
|
104 | 104 | end |
|
105 | 105 | |
|
106 | def test_show_should_display_nil_counts | |
|
107 | with_settings :default_language => 'en' do | |
|
108 | get :show, :id => 2, :status_by => 'category' | |
|
109 | assert_response :success | |
|
110 | assert_select 'div#status_by' do | |
|
111 | assert_select 'select[name=status_by]' do | |
|
112 | assert_select 'option[value=category][selected=selected]' | |
|
113 | end | |
|
114 | assert_select 'a', :text => 'none' | |
|
115 | end | |
|
116 | end | |
|
117 | end | |
|
118 | ||
|
106 | 119 | def test_new |
|
107 | 120 | @request.session[:user_id] = 2 |
|
108 | 121 | get :new, :project_id => '1' |
General Comments 0
You need to be logged in to leave comments.
Login now