diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-05-07 10:42:22 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-05-07 10:42:22 +0000 |
commit | ed50d42210eaf7ca216e9cd3a043b36aa68eb51d (patch) | |
tree | fbc801683ee622f43e790ec6cf2785fd8f94a43c /app/models/version.rb | |
parent | 40c9c3e922e15ab7d88b5d06c60e51ed1ba40a7f (diff) | |
download | redmine-ed50d42210eaf7ca216e9cd3a043b36aa68eb51d.tar.gz redmine-ed50d42210eaf7ca216e9cd3a043b36aa68eb51d.zip |
Replace Date.today with User.current.today (#22320).
Depending on the offset between a user's configured timezone and the server
timezone, Date.today may be more or less often wrong from the user's
perspective, leading to things like issues marked as overdue too early or too
late, or yesterday / tomorrow being displayed / selected where 'today' is
intended.
A test case illustrating the problem with Issue#overdue? is included
Patch by Jens Kraemer.
git-svn-id: http://svn.redmine.org/redmine/trunk@15379 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/version.rb')
-rw-r--r-- | app/models/version.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/version.rb b/app/models/version.rb index ad3d816fb..bc71b72e9 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -104,7 +104,7 @@ class Version < ActiveRecord::Base # Returns true if the version is completed: closed or due date reached and no open issues def completed? - closed? || (effective_date && (effective_date < Date.today) && (open_issues_count == 0)) + closed? || (effective_date && (effective_date < User.current.today) && (open_issues_count == 0)) end def behind_schedule? @@ -112,7 +112,7 @@ class Version < ActiveRecord::Base return false elsif due_date && start_date done_date = start_date + ((due_date - start_date+1)* completed_percent/100).floor - return done_date <= Date.today + return done_date <= User.current.today else false # No issues so it's not late end @@ -141,7 +141,7 @@ class Version < ActiveRecord::Base # Returns true if the version is overdue: due date reached and some open issues def overdue? - effective_date && (effective_date < Date.today) && (open_issues_count > 0) + effective_date && (effective_date < User.current.today) && (open_issues_count > 0) end # Returns assigned issues count |