Feature #30464 » estimated-hours-on-overview-page-v3.diff
| app/controllers/projects_controller.rb (working copy) | ||
|---|---|---|
| 158 | 158 | |
| 159 | 159 |
if User.current.allowed_to_view_all_time_entries?(@project) |
| 160 | 160 |
@total_hours = TimeEntry.visible.where(cond).sum(:hours).to_f |
| 161 |
@total_estimated_hours = Issue.visible.where(cond).sum(:estimated_hours).to_f |
|
| 161 | 162 |
end |
| 162 | 163 | |
| 163 | 164 |
@key = User.current.rss_key |
| app/views/projects/show.html.erb (working copy) | ||
|---|---|---|
| 83 | 83 | |
| 84 | 84 |
<% if User.current.allowed_to?(:view_time_entries, @project) %> |
| 85 | 85 |
<div class="spent_time box"> |
| 86 |
<h3 class="icon icon-time"><%= l(:label_spent_time) %></h3> |
|
| 87 |
<% if @total_hours.present? %> |
|
| 88 |
<p><%= l_hours(@total_hours) %></p> |
|
| 89 |
<% end %> |
|
| 86 |
<h3 class="icon icon-time"><%= l(:label_time_tracking) %></h3> |
|
| 87 |
<ul> |
|
| 88 |
<% if @total_estimated_hours.present? %> |
|
| 89 |
<li><%= l(:field_estimated_hours) %>: <%= l_hours(@total_estimated_hours) %> |
|
| 90 |
<% end %> |
|
| 91 |
<% if @total_hours.present? %> |
|
| 92 |
<li><%= l(:label_spent_time) %>: <%= l_hours(@total_hours) %> |
|
| 93 |
<% end %> |
|
| 94 |
</ul> |
|
| 90 | 95 |
<p> |
| 91 | 96 |
<% if User.current.allowed_to?(:log_time, @project) %> |
| 92 | 97 |
<%= link_to l(:button_log_time), new_project_time_entry_path(@project) %> | |
| test/functional/projects_controller_test.rb (working copy) | ||
|---|---|---|
| 575 | 575 |
assert_select 'table.issue-report td.total a', :text => %r{\A[1-9]\d*\z}
|
| 576 | 576 |
end |
| 577 | 577 | |
| 578 |
def test_show_should_spent_and_estimated_time |
|
| 579 |
@request.session[:user_id] = 1 |
|
| 580 |
get :show, :params => {
|
|
| 581 |
:id => 'ecookbook' |
|
| 582 |
} |
|
| 583 | ||
| 584 |
assert_select 'div.spent_time.box>ul' do |
|
| 585 |
assert_select '>li:nth-child(1)', :text => 'Estimated time: 203.50 hours' |
|
| 586 |
assert_select '>li:nth-child(2)', :text => 'Spent time: 162.90 hours' |
|
| 587 |
end |
|
| 588 |
end |
|
| 589 | ||
| 578 | 590 |
def test_settings |
| 579 | 591 |
@request.session[:user_id] = 2 # manager |
| 580 | 592 |
get :settings, :params => {
|
- « Previous
- 1
- …
- 3
- 4
- 5
- Next »