diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index a3eac71ab..39eb33b99 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -90,7 +90,11 @@ class ProjectsController < ApplicationController
@trackers = @project.trackers
@open_issues_by_tracker = Issue.count(:group => :tracker, :joins => "INNER JOIN #{IssueStatus.table_name} ON #{IssueStatus.table_name}.id = #{Issue.table_name}.status_id", :conditions => ["project_id=? and #{IssueStatus.table_name}.is_closed=?", @project.id, false])
@total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id])
- @total_hours = @project.time_entries.sum(:hours)
+ TimeEntry.visible_by(User.current) do
+ @total_hours = TimeEntry.sum(:hours,
+ :include => :project,
+ :conditions => ["(#{Project.table_name}.id = ? OR #{Project.table_name}.parent_id = ?)", @project.id, @project.id]).to_f
+ end
@key = User.current.rss_key
end
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb
index 6ce86fd50..d672ac577 100644
--- a/app/controllers/timelog_controller.rb
+++ b/app/controllers/timelog_controller.rb
@@ -26,26 +26,30 @@ class TimelogController < ApplicationController
include TimelogHelper
def report
- @available_criterias = { 'version' => {:sql => "#{Issue.table_name}.fixed_version_id",
- :values => @project.versions,
+ @available_criterias = { 'project' => {:sql => "#{TimeEntry.table_name}.project_id",
+ :klass => Project,
+ :label => :label_project},
+ 'version' => {:sql => "#{Issue.table_name}.fixed_version_id",
+ :klass => Version,
:label => :label_version},
'category' => {:sql => "#{Issue.table_name}.category_id",
- :values => @project.issue_categories,
+ :klass => IssueCategory,
:label => :field_category},
'member' => {:sql => "#{TimeEntry.table_name}.user_id",
- :values => @project.users,
+ :klass => User,
:label => :label_member},
'tracker' => {:sql => "#{Issue.table_name}.tracker_id",
- :values => Tracker.find(:all),
+ :klass => Tracker,
:label => :label_tracker},
'activity' => {:sql => "#{TimeEntry.table_name}.activity_id",
- :values => Enumeration::get_values('ACTI'),
+ :klass => Enumeration,
:label => :label_activity}
}
@criterias = params[:criterias] || []
@criterias = @criterias.select{|criteria| @available_criterias.has_key? criteria}
@criterias.uniq!
+ @criterias = @criterias[0,3]
@columns = (params[:period] && %w(year month week).include?(params[:period])) ? params[:period] : 'month'
@@ -63,8 +67,11 @@ class TimelogController < ApplicationController
sql_group_by = @criterias.collect{|criteria| @available_criterias[criteria][:sql]}.join(', ')
sql = "SELECT #{sql_select}, tyear, tmonth, tweek, SUM(hours) AS hours"
- sql << " FROM #{TimeEntry.table_name} LEFT JOIN #{Issue.table_name} ON #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id"
- sql << " WHERE #{TimeEntry.table_name}.project_id = %s" % @project.id
+ sql << " FROM #{TimeEntry.table_name}"
+ sql << " LEFT JOIN #{Issue.table_name} ON #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id"
+ sql << " LEFT JOIN #{Project.table_name} ON #{TimeEntry.table_name}.project_id = #{Project.table_name}.id"
+ sql << " WHERE (#{Project.table_name}.id = %s OR #{Project.table_name}.parent_id = %s)" % [@project.id, @project.id]
+ sql << " AND (%s)" % Project.allowed_to_condition(User.current, :view_time_entries)
sql << " AND spent_on BETWEEN '%s' AND '%s'" % [ActiveRecord::Base.connection.quoted_date(@date_from.to_time), ActiveRecord::Base.connection.quoted_date(@date_to.to_time)]
sql << " GROUP BY #{sql_group_by}, tyear, tmonth, tweek"
@@ -80,6 +87,8 @@ class TimelogController < ApplicationController
row['week'] = "#{row['tyear']}-#{row['tweek']}"
end
end
+
+ @total_hours = @hours.inject(0) {|s,k| s = s + k['hours'].to_f}
end
@periods = []
@@ -147,41 +156,44 @@ class TimelogController < ApplicationController
@from, @to = @to, @from if @from && @to && @from > @to
- conditions = nil
+ cond = ARCondition.new
+ cond << (@issue.nil? ? ["(#{Project.table_name}.id = ? OR #{Project.table_name}.parent_id = ?)", @project.id, @project.id] :
+ ["#{TimeEntry.table_name}.issue_id = ?", @issue.id])
+
if @from
if @to
- conditions = ['spent_on BETWEEN ? AND ?', @from, @to]
+ cond << ['spent_on BETWEEN ? AND ?', @from, @to]
else
- conditions = ['spent_on >= ?', @from]
+ cond << ['spent_on >= ?', @from]
end
elsif @to
- conditions = ['spent_on <= ?', @to]
+ cond << ['spent_on <= ?', @to]
end
-
- @owner_id = User.current.id
- respond_to do |format|
- format.html {
- # Paginate results
- @entry_count = (@issue ? @issue : @project).time_entries.count(:conditions => conditions)
- @entry_pages = Paginator.new self, @entry_count, per_page_option, params['page']
- @entries = (@issue ? @issue : @project).time_entries.find(:all,
- :include => [:activity, :user, {:issue => [:tracker, :assigned_to, :priority]}],
- :conditions => conditions,
- :order => sort_clause,
- :limit => @entry_pages.items_per_page,
- :offset => @entry_pages.current.offset)
- @total_hours = (@issue ? @issue : @project).time_entries.sum(:hours, :conditions => conditions).to_f
- render :layout => !request.xhr?
- }
- format.csv {
- # Export all entries
- @entries = (@issue ? @issue : @project).time_entries.find(:all,
- :include => [:activity, :user, {:issue => [:tracker, :assigned_to, :priority]}],
- :conditions => conditions,
- :order => sort_clause)
- send_data(entries_to_csv(@entries).read, :type => 'text/csv; header=present', :filename => 'timelog.csv')
- }
+ TimeEntry.visible_by(User.current) do
+ respond_to do |format|
+ format.html {
+ # Paginate results
+ @entry_count = TimeEntry.count(:include => :project, :conditions => cond.conditions)
+ @entry_pages = Paginator.new self, @entry_count, per_page_option, params['page']
+ @entries = TimeEntry.find(:all,
+ :include => [:project, :activity, :user, {:issue => :tracker}],
+ :conditions => cond.conditions,
+ :order => sort_clause,
+ :limit => @entry_pages.items_per_page,
+ :offset => @entry_pages.current.offset)
+ @total_hours = TimeEntry.sum(:hours, :include => :project, :conditions => cond.conditions).to_f
+ render :layout => !request.xhr?
+ }
+ format.csv {
+ # Export all entries
+ @entries = TimeEntry.find(:all,
+ :include => [:project, :activity, :user, {:issue => [:tracker, :assigned_to, :priority]}],
+ :conditions => cond.conditions,
+ :order => sort_clause)
+ send_data(entries_to_csv(@entries).read, :type => 'text/csv; header=present', :filename => 'timelog.csv')
+ }
+ end
end
end
diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb
index 2af748f6f..05b55907c 100644
--- a/app/helpers/timelog_helper.rb
+++ b/app/helpers/timelog_helper.rb
@@ -17,7 +17,7 @@
module TimelogHelper
def select_hours(data, criteria, value)
- data.select {|row| row[criteria] == value.to_s}
+ data.select {|row| row[criteria] == value}
end
def sum_hours(data)
@@ -50,6 +50,7 @@ module TimelogHelper
headers = [l(:field_spent_on),
l(:field_user),
l(:field_activity),
+ l(:field_project),
l(:field_issue),
l(:field_tracker),
l(:field_subject),
@@ -62,6 +63,7 @@ module TimelogHelper
fields = [l_date(entry.spent_on),
entry.user,
entry.activity,
+ entry.project,
(entry.issue ? entry.issue.id : nil),
(entry.issue ? entry.issue.tracker : nil),
(entry.issue ? entry.issue.subject : nil),
diff --git a/app/models/project.rb b/app/models/project.rb
index 73a8d6404..8f1dada1d 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -110,6 +110,21 @@ class Project < ActiveRecord::Base
end
end
+ def self.allowed_to_condition(user, permission)
+ statements = []
+ active_statement = "#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"
+ if user.admin?
+ # no restriction
+ elsif user.logged?
+ statements << "#{Project.table_name}.is_public = #{connection.quoted_true}" if Role.non_member.allowed_to?(permission)
+ allowed_project_ids = user.memberships.select {|m| m.role.allowed_to?(permission)}.collect {|m| m.project_id}
+ statements << "#{Project.table_name}.id IN (#{allowed_project_ids.join(',')})"
+ else
+ statements << "#{Project.table_name}.is_public = #{connection.quoted_true}" if Role.anonymous.allowed_to?(permission)
+ end
+ statements.empty? ? active_statement : "(#{active_statement} AND (#{statements.join(' OR ')}))"
+ end
+
def self.find(*args)
if args.first && args.first.is_a?(String) && !args.first.match(/^\d*$/)
project = find_by_identifier(*args)
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb
index 04df5233f..0f8f62889 100644
--- a/app/models/time_entry.rb
+++ b/app/models/time_entry.rb
@@ -52,4 +52,10 @@ class TimeEntry < ActiveRecord::Base
def editable_by?(usr)
usr == self.user
end
+
+ def self.visible_by(usr)
+ with_scope(:find => { :conditions => Project.allowed_to_condition(usr, :view_time_entries) }) do
+ yield
+ end
+ end
end
diff --git a/app/views/timelog/_list.rhtml b/app/views/timelog/_list.rhtml
index 929d8f7dd..ae5b6376a 100644
--- a/app/views/timelog/_list.rhtml
+++ b/app/views/timelog/_list.rhtml
@@ -3,6 +3,7 @@
<%= sort_header_tag('spent_on', :caption => l(:label_date), :default_order => 'desc') %>
<%= sort_header_tag('user_id', :caption => l(:label_member)) %>
<%= sort_header_tag('activity_id', :caption => l(:label_activity)) %>
+<%= sort_header_tag("#{Project.table_name}.name", :caption => l(:label_project)) %>
<%= sort_header_tag('issue_id', :caption => l(:label_issue), :default_order => 'desc') %>
<%= l(:field_comments) %> |
<%= sort_header_tag('hours', :caption => l(:field_hours)) %>
@@ -12,17 +13,16 @@
<% entries.each do |entry| -%>
">
<%= format_date(entry.spent_on) %> |
-<%= entry.user.name %> |
-<%= entry.activity.name %> |
+<%=h entry.user %> |
+<%=h entry.activity %> |
+<%=h entry.project %> |
- <% if entry.issue -%>
- <%= link_to_issue entry.issue %>: <%= h(truncate(entry.issue.subject, 50)) -%>
- <%= render_issue_tooltip entry.issue %>
-
- <% end -%>
+<% if entry.issue -%>
+<%= link_to_issue entry.issue %>: <%= h(truncate(entry.issue.subject, 50)) -%>
+<% end -%>
|
-<%= entry.hours %> |
+<%= html_hours("%.2f" % entry.hours) %> |
<%= link_to_if_authorized(l(:button_edit),
{:controller => 'timelog', :action => 'edit', :id => entry},
:class => 'icon icon-edit') if entry.editable_by?(User.current) %> |
diff --git a/app/views/timelog/_report_criteria.rhtml b/app/views/timelog/_report_criteria.rhtml
index 0b7e91cfd..b048c874a 100644
--- a/app/views/timelog/_report_criteria.rhtml
+++ b/app/views/timelog/_report_criteria.rhtml
@@ -1,17 +1,17 @@
-<% @available_criterias[criterias[level]][:values].each do |value| %>
-
+<% @hours.collect {|h| h[criterias[level]]}.uniq.each do |value| %>
+<% hours_for_value = select_hours(hours, criterias[level], value) -%>
+<% next if hours_for_value.empty? -%>
+
<%= ' | ' * level %>
-<%= value.name %> |
-<%= ' | ' * (criterias.length - level - 1) %>
-<% hours_for_value = select_hours(hours, criterias[level], value.id) %>
- <% @periods.each do |period| %>
+<%= value.nil? ? l(:label_none) : @available_criterias[criterias[level]][:klass].find_by_id(value) %> |
+<%= ' | ' * (criterias.length - level - 1) -%>
+ <% @periods.each do |period| -%>
<% sum = sum_hours(select_hours(hours_for_value, @columns, period.to_s)) %>
- <%= sum > 0 ? "%.2f" % sum : "-" %> |
- <% end %>
+ <%= html_hours("%.2f" % sum) if sum > 0 %> |
+ <% end -%>
-<% if criterias.length > level+1 %>
+<% if criterias.length > level+1 -%>
<%= render(:partial => 'report_criteria', :locals => {:criterias => criterias, :hours => hours_for_value, :level => (level + 1)}) %>
-<% end %>
+<% end -%>
<% end %>
-<% reset_cycle %>
diff --git a/app/views/timelog/details.rhtml b/app/views/timelog/details.rhtml
index 0e128f6ae..802090b7a 100644
--- a/app/views/timelog/details.rhtml
+++ b/app/views/timelog/details.rhtml
@@ -1,4 +1,5 @@
+<%= link_to(l(:label_report), {:controller => 'timelog', :action => 'report', :project_id => @project}, :class => 'icon icon-report') %>
<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time' %>
@@ -25,7 +26,7 @@
<%= text_field_tag 'from', @from, :size => 10, :onfocus => '$("period_type_2").checked = true;' %> <%= calendar_for('from') %>
<%= l(:label_date_to) %>
<%= text_field_tag 'to', @to, :size => 10, :onfocus => '$("period_type_2").checked = true;' %> <%= calendar_for('to') %>
-<%= submit_tag l(:button_submit), :name => nil, :onclick => '$("period_type_2").checked = true;' %>
+<%= submit_tag l(:button_apply), :name => nil, :onclick => '$("period_type_2").checked = true;' %>
<% end %>
diff --git a/app/views/timelog/report.rhtml b/app/views/timelog/report.rhtml
index 4fabfe3dd..8fc15a3b4 100644
--- a/app/views/timelog/report.rhtml
+++ b/app/views/timelog/report.rhtml
@@ -1,31 +1,43 @@
+
+<%= link_to(l(:label_details), {:controller => 'timelog', :action => 'details', :project_id => @project}, :class => 'icon icon-details') %>
+<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time' %>
+
+
<%= l(:label_spent_time) %>
<% form_remote_tag(:url => {:project_id => @project}, :update => 'content') do %>
<% @criterias.each do |criteria| %>
<%= hidden_field_tag 'criterias[]', criteria %>
<% end %>
+
- <% if @criterias.length < 3 %>
- <%= l(:button_add) %>: <%= select_tag('criterias[]', options_for_select([[]] + (@available_criterias.keys - @criterias).collect{|k| [l(@available_criterias[k][:label]), k]}), :onchange => "this.form.onsubmit();") %>
- <% end %>
+ <%= l(:button_add) %>: <%= select_tag('criterias[]', options_for_select([[]] + (@available_criterias.keys - @criterias).collect{|k| [l(@available_criterias[k][:label]), k]}),
+ :onchange => "this.form.onsubmit();",
+ :style => 'width: 200px',
+ :disabled => (@criterias.length >= 3)) %>
+ <%= link_to_remote l(:button_clear), {:url => {:project_id => @project, :date_from => @date_from, :date_to => @date_to, :period => @columns}, :update => 'content'},
+ :class => 'icon icon-reload' %>
-
+<% unless @criterias.empty? %>
+
+
<%= l(:label_total) %>: <%= html_hours(lwr(:label_f_hour, @total_hours)) %>
+
-<% unless @criterias.empty? %>
-
+<% unless @hours.empty? %>
+
<% @criterias.each do |criteria| %>
@@ -36,13 +48,21 @@
<% end %>
-
<%= render :partial => 'report_criteria', :locals => {:criterias => @criterias, :hours => @hours, :level => 0} %>
+
+ <%= l(:label_total) %> |
+ <%= ' | ' * (@criterias.size - 1) %>
+ <% @periods.each do |period| -%>
+ <% sum = sum_hours(select_hours(@hours, @columns, period.to_s)) %>
+ <%= html_hours("%.2f" % sum) if sum > 0 %> |
+ <% end -%>
+
<% end %>
<% end %>
+<% end %>
<% content_for :header_tags do %>
<%= javascript_include_tag 'calendar/calendar' %>
diff --git a/lib/ar_condition.rb b/lib/ar_condition.rb
new file mode 100644
index 000000000..b08e90761
--- /dev/null
+++ b/lib/ar_condition.rb
@@ -0,0 +1,41 @@
+# redMine - project management software
+# Copyright (C) 2006-2008 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class ARCondition
+ attr_reader :conditions
+
+ def initialize(condition=nil)
+ @conditions = ['1=1']
+ @conditions.add(condition) if condition
+ end
+
+ def add(condition)
+ if condition.is_a?(Array)
+ @conditions.first << " AND (#{condition.first})"
+ @conditions += condition[1..-1]
+ elsif condition.is_a?(String)
+ @conditions.first << " AND (#{condition})"
+ else
+ raise "Unsupported #{condition.class} condition: #{condition}"
+ end
+ self
+ end
+
+ def <<(condition)
+ add(condition)
+ end
+end
diff --git a/public/images/report.png b/public/images/report.png
new file mode 100644
index 000000000..05386ac4f
Binary files /dev/null and b/public/images/report.png differ
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 003b21eca..b3dcac6b0 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -112,7 +112,8 @@ tr.user.locked a, tr.user.registered a { color: #aaa; }
tr.time-entry { text-align: center; white-space: nowrap; }
tr.time-entry td.subject, tr.time-entry td.comments { text-align: left; }
-tr.time-entry td.hours { text-align: right; font-weight: bold; padding-right: 0.6em; }
+tr.time-entry td.hours { text-align: right; font-weight: bold; padding-right: 0.5em; }
+tr.time-entry .hours-dec { font-size: 0.9em; }
table.list tbody tr:hover { background-color:#ffffdd; }
table td {padding:2px;}
@@ -173,6 +174,12 @@ div#roadmap .wiki h1:first-child { display: none; }
div#roadmap .wiki h1 { font-size: 120%; }
div#roadmap .wiki h2 { font-size: 110%; }
+table#time-report td.hours { text-align: right; padding-right: 0.5em; }
+table#time-report tbody tr { font-style: italic; color: #777; }
+table#time-report tbody tr.last-level { font-style: normal; color: #555; }
+table#time-report tbody tr.total { font-style: normal; font-weight: bold; color: #555; background-color:#EEEEEE; }
+table#time-report .hours-dec { font-size: 0.9em; }
+
div.total-hours { text-align: left; font-size: 110%; font-weight: bold; }
div.total-hours span.hours-int { font-size: 120%; }
@@ -536,6 +543,8 @@ vertical-align: middle;
.icon-lock { background-image: url(../images/locked.png); }
.icon-unlock { background-image: url(../images/unlock.png); }
.icon-checked { background-image: url(../images/true.png); }
+.icon-details { background-image: url(../images/zoom_in.png); }
+.icon-report { background-image: url(../images/report.png); }
.icon22-projects { background-image: url(../images/22x22/projects.png); }
.icon22-users { background-image: url(../images/22x22/users.png); }
diff --git a/test/fixtures/time_entries.yml b/test/fixtures/time_entries.yml
index ae2b1efea..151077d2b 100644
--- a/test/fixtures/time_entries.yml
+++ b/test/fixtures/time_entries.yml
@@ -6,7 +6,7 @@ time_entries_001:
project_id: 1
comments: My hours
updated_on: 2007-03-23 12:54:18 +01:00
- activity_id: 8
+ activity_id: 9
spent_on: 2007-03-23
issue_id: 1
id: 1
@@ -20,7 +20,7 @@ time_entries_002:
project_id: 1
comments: ""
updated_on: 2007-03-23 14:11:04 +01:00
- activity_id: 8
+ activity_id: 9
spent_on: 2007-03-12
issue_id: 1
id: 2
@@ -34,10 +34,25 @@ time_entries_003:
project_id: 1
comments: ""
updated_on: 2007-04-21 12:20:48 +02:00
- activity_id: 8
+ activity_id: 9
spent_on: 2007-04-21
issue_id: 2
id: 3
hours: 1.0
user_id: 1
tyear: 2007
+time_entries_004:
+ created_on: 2007-04-22 12:20:48 +02:00
+ tweek: 16
+ tmonth: 4
+ project_id: 3
+ comments: Time spent on a subproject
+ updated_on: 2007-04-22 12:20:48 +02:00
+ activity_id: 10
+ spent_on: 2007-04-22
+ issue_id:
+ id: 4
+ hours: 7.65
+ user_id: 1
+ tyear: 2007
+
\ No newline at end of file
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index e1236ffac..4163ce548 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -37,27 +37,39 @@ class TimelogControllerTest < Test::Unit::TestCase
end
def test_report_one_criteria
- get :report, :project_id => 1, :period => "month", :date_from => "2007-01-01", :date_to => "2007-12-31", :criterias => ["member"]
+ get :report, :project_id => 1, :period => 'week', :date_from => "2007-04-01", :date_to => "2007-04-30", :criterias => ['project']
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:hours)
- end
+ assert_not_nil assigns(:total_hours)
+ assert_equal "8.65", "%.2f" % assigns(:total_hours)
+ end
def test_report_two_criterias
- get :report, :project_id => 1, :period => "week", :date_from => "2007-01-01", :date_to => "2007-12-31", :criterias => ["member", "activity"]
+ get :report, :project_id => 1, :period => 'month', :date_from => "2007-01-01", :date_to => "2007-12-31", :criterias => ["member", "activity"]
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:hours)
+ assert_not_nil assigns(:total_hours)
+ assert_equal "162.90", "%.2f" % assigns(:total_hours)
end
+ def test_report_one_criteria_no_result
+ get :report, :project_id => 1, :period => 'week', :date_from => "1998-04-01", :date_to => "1998-04-30", :criterias => ['project']
+ assert_response :success
+ assert_template 'report'
+ assert_not_nil assigns(:total_hours)
+ assert_equal "0.00", "%.2f" % assigns(:total_hours)
+ end
+
def test_details_at_project_level
get :details, :project_id => 1
assert_response :success
assert_template 'details'
assert_not_nil assigns(:entries)
- assert_equal 3, assigns(:entries).size
+ assert_equal 4, assigns(:entries).size
+ # project and subproject
+ assert_equal [1, 3], assigns(:entries).collect(&:project_id).uniq.sort
assert_not_nil assigns(:total_hours)
- assert_equal 155.25, assigns(:total_hours)
+ assert_equal "162.90", "%.2f" % assigns(:total_hours)
# display all time by default
assert_nil assigns(:from)
assert_nil assigns(:to)
@@ -68,9 +80,9 @@ class TimelogControllerTest < Test::Unit::TestCase
assert_response :success
assert_template 'details'
assert_not_nil assigns(:entries)
- assert_equal 2, assigns(:entries).size
+ assert_equal 3, assigns(:entries).size
assert_not_nil assigns(:total_hours)
- assert_equal 5.25, assigns(:total_hours)
+ assert_equal "12.90", "%.2f" % assigns(:total_hours)
assert_equal '2007-03-20'.to_date, assigns(:from)
assert_equal '2007-04-30'.to_date, assigns(:to)
end