Feature #30464 » estimated-hours-on-overview-page-v2.diff
| app/controllers/projects_controller.rb (working copy) | ||
|---|---|---|
|
if User.current.allowed_to_view_all_time_entries?(@project)
|
||
|
@total_hours = TimeEntry.visible.where(cond).sum(:hours).to_f
|
||
|
@total_estimated_hours = Issue.visible.where(cond).sum(:estimated_hours).to_f
|
||
|
end
|
||
|
@key = User.current.rss_key
|
||
| app/views/projects/show.html.erb (working copy) | ||
|---|---|---|
|
<% if User.current.allowed_to?(:view_time_entries, @project) %>
|
||
|
<div class="spent_time box">
|
||
|
<h3 class="icon icon-time"><%= l(:label_spent_time) %></h3>
|
||
|
<h3 class="icon icon-time"><%= l(:label_time_tracking) %></h3>
|
||
|
<ul>
|
||
|
<% if @total_hours.present? %>
|
||
|
<p><%= l_hours(@total_hours) %></p>
|
||
|
<li><%= l(:label_spent_time) %>: <%= l_hours(@total_hours) %>
|
||
|
<% end %>
|
||
|
<% if @total_estimated_hours.present? %>
|
||
|
<li><%= l(:field_estimated_hours) %>: <%= l_hours(@total_estimated_hours) %>
|
||
|
<% end %>
|
||
|
</ul>
|
||
|
<p>
|
||
|
<% if User.current.allowed_to?(:log_time, @project) %>
|
||
|
<%= link_to l(:button_log_time), new_project_time_entry_path(@project) %> |
|
||
| test/fixtures/issues.yml (working copy) | ||
|---|---|---|
|
status_id: 1
|
||
|
start_date: <%= 1.day.ago.to_date.to_s(:db) %>
|
||
|
due_date: <%= 10.day.from_now.to_date.to_s(:db) %>
|
||
|
estimated_hours: 200.0
|
||
|
root_id: 1
|
||
|
lft: 1
|
||
|
rgt: 2
|
||
| ... | ... | |
|
start_date: <%= 2.day.ago.to_date.to_s(:db) %>
|
||
|
due_date:
|
||
|
root_id: 2
|
||
|
estimated_hours: 0.5
|
||
|
lft: 1
|
||
|
rgt: 2
|
||
|
lock_version: 3
|
||
| ... | ... | |
|
status_id: 1
|
||
|
start_date: <%= 15.day.ago.to_date.to_s(:db) %>
|
||
|
due_date: <%= 5.day.ago.to_date.to_s(:db) %>
|
||
|
estimated_hours: 1.0
|
||
|
root_id: 3
|
||
|
lft: 1
|
||
|
rgt: 2
|
||
| ... | ... | |
|
assigned_to_id:
|
||
|
author_id: 2
|
||
|
status_id: 1
|
||
|
estimated_hours: 2.0
|
||
|
root_id: 5
|
||
|
lft: 1
|
||
|
rgt: 2
|
||
| test/functional/projects_controller_test.rb (working copy) | ||
|---|---|---|
|
assert_select 'table.issue-report td.total a', :text => %r{\A[1-9]\d*\z}
|
||
|
end
|
||
|
def test_show_should_spent_and_estimated_time
|
||
|
@request.session[:user_id] = 1
|
||
|
get :show, :params => {
|
||
|
:id => 'ecookbook'
|
||
|
}
|
||
|
assert_select 'div.spent_time.box>ul' do
|
||
|
assert_select 'li:nth-child(1)', :text => 'Spent time: 162.90 hours'
|
||
|
assert_select 'li:nth-child(2)', :text => 'Estimated time: 203.50 hours'
|
||
|
end
|
||
|
end
|
||
|
def test_settings
|
||
|
@request.session[:user_id] = 2 # manager
|
||
|
get :settings, :params => {
|
||