@@ -44,7 +44,8 module VersionsHelper | |||||
44 | rescue ActiveRecord::RecordNotFound |
|
44 | rescue ActiveRecord::RecordNotFound | |
45 | # When grouping by an association, Rails throws this exception if there's no result (bug) |
|
45 | # When grouping by an association, Rails throws this exception if there's no result (bug) | |
46 | end |
|
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 | max = counts.collect {|c| c[:total]}.max |
|
49 | max = counts.collect {|c| c[:total]}.max | |
49 |
|
50 | |||
50 | render :partial => 'issue_counts', :locals => {:version => version, :criteria => criteria, :counts => counts, :max => max} |
|
51 | render :partial => 'issue_counts', :locals => {:version => version, :criteria => criteria, :counts => counts, :max => max} |
@@ -14,12 +14,11 | |||||
14 | <% counts.each do |count| %> |
|
14 | <% counts.each do |count| %> | |
15 | <tr> |
|
15 | <tr> | |
16 | <td width="130px" align="right" > |
|
16 | <td width="130px" align="right" > | |
17 | <%= link_to h(count[:group]), {:controller => 'issues', |
|
17 | <% if count[:group] -%> | |
18 | :action => 'index', |
|
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 | :project_id => version.project, |
|
19 | <% else -%> | |
20 | :set_filter => 1, |
|
20 | <%= link_to(l(:label_none), project_issues_path(version.project, :set_filter => 1, :status_id => '*', :fixed_version_id => version, "#{criteria}_id" => "!*")) %> | |
21 | :status_id => '*', |
|
21 | <% end %> | |
22 | :fixed_version_id => version}.merge("#{criteria}_id".to_sym => count[:group]) %> |
|
|||
23 | </td> |
|
22 | </td> | |
24 | <td width="240px"> |
|
23 | <td width="240px"> | |
25 | <%= progress_bar((count[:closed].to_f / count[:total])*100, |
|
24 | <%= progress_bar((count[:closed].to_f / count[:total])*100, |
@@ -22,7 +22,7 require 'versions_controller' | |||||
22 | class VersionsController; def rescue_action(e) raise e end; end |
|
22 | class VersionsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class VersionsControllerTest < ActionController::TestCase |
|
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 | def setup |
|
27 | def setup | |
28 | @controller = VersionsController.new |
|
28 | @controller = VersionsController.new | |
@@ -103,6 +103,19 class VersionsControllerTest < ActionController::TestCase | |||||
103 | assert_tag :tag => 'h2', :content => /1.0/ |
|
103 | assert_tag :tag => 'h2', :content => /1.0/ | |
104 | end |
|
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 | def test_new |
|
119 | def test_new | |
107 | @request.session[:user_id] = 2 |
|
120 | @request.session[:user_id] = 2 | |
108 | get :new, :project_id => '1' |
|
121 | get :new, :project_id => '1' |
General Comments 0
You need to be logged in to leave comments.
Login now