mirror of
https://github.com/redmine/redmine.git
synced 2025-11-13 16:56:00 +01:00
Show estimated time on the overview page as well as spent time (#30464).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@17838 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -158,6 +158,7 @@ class ProjectsController < ApplicationController
|
|||||||
|
|
||||||
if User.current.allowed_to_view_all_time_entries?(@project)
|
if User.current.allowed_to_view_all_time_entries?(@project)
|
||||||
@total_hours = TimeEntry.visible.where(cond).sum(:hours).to_f
|
@total_hours = TimeEntry.visible.where(cond).sum(:hours).to_f
|
||||||
|
@total_estimated_hours = Issue.visible.where(cond).sum(:estimated_hours).to_f
|
||||||
end
|
end
|
||||||
|
|
||||||
@key = User.current.rss_key
|
@key = User.current.rss_key
|
||||||
|
|||||||
@@ -83,10 +83,15 @@
|
|||||||
|
|
||||||
<% if User.current.allowed_to?(:view_time_entries, @project) %>
|
<% if User.current.allowed_to?(:view_time_entries, @project) %>
|
||||||
<div class="spent_time box">
|
<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>
|
||||||
<% if @total_hours.present? %>
|
<ul>
|
||||||
<p><%= l_hours(@total_hours) %></p>
|
<% if @total_estimated_hours.present? %>
|
||||||
|
<li><%= l(:field_estimated_hours) %>: <%= l_hours(@total_estimated_hours) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if @total_hours.present? %>
|
||||||
|
<li><%= l(:label_spent_time) %>: <%= l_hours(@total_hours) %>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
<% if User.current.allowed_to?(:log_time, @project) %>
|
<% if User.current.allowed_to?(:log_time, @project) %>
|
||||||
<%= link_to l(:button_log_time), new_project_time_entry_path(@project) %> |
|
<%= link_to l(:button_log_time), new_project_time_entry_path(@project) %> |
|
||||||
|
|||||||
@@ -575,6 +575,18 @@ class ProjectsControllerTest < Redmine::ControllerTest
|
|||||||
assert_select 'table.issue-report td.total a', :text => %r{\A[1-9]\d*\z}
|
assert_select 'table.issue-report td.total a', :text => %r{\A[1-9]\d*\z}
|
||||||
end
|
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 => 'Estimated time: 203.50 hours'
|
||||||
|
assert_select '>li:nth-child(2)', :text => 'Spent time: 162.90 hours'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_settings
|
def test_settings
|
||||||
@request.session[:user_id] = 2 # manager
|
@request.session[:user_id] = 2 # manager
|
||||||
get :settings, :params => {
|
get :settings, :params => {
|
||||||
|
|||||||
Reference in New Issue
Block a user