Commit d6378456 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Force TimeEntry#hours default to nil (#3075, #4449).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3232 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 5e1dc78d
...@@ -44,6 +44,7 @@ class TimeEntry < ActiveRecord::Base ...@@ -44,6 +44,7 @@ class TimeEntry < ActiveRecord::Base
if default_activity = TimeEntryActivity.default if default_activity = TimeEntryActivity.default
self.activity_id = default_activity.id self.activity_id = default_activity.id
end end
self.hours = nil if hours == 0
end end
end end
......
...@@ -44,4 +44,8 @@ class TimeEntryTest < ActiveSupport::TestCase ...@@ -44,4 +44,8 @@ class TimeEntryTest < ActiveSupport::TestCase
assert_equal v, t.hours, "Converting #{k} failed:" assert_equal v, t.hours, "Converting #{k} failed:"
end end
end end
def test_hours_should_default_to_nil
assert_nil TimeEntry.new.hours
end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment