summaryrefslogtreecommitdiff
path: root/app/models/concerns/time_trackable.rb
diff options
context:
space:
mode:
authorVlad <vlad.bilanchuk@teamvoy.com>2017-09-22 19:20:44 +0300
committerSean McGivern <sean@gitlab.com>2017-10-13 11:41:49 +0100
commit945e0684afc3c22ac658dbb68005cb2ebf5ac51c (patch)
tree90cb7fdd46b13735002d0ecd4e8ae5d75c94201d /app/models/concerns/time_trackable.rb
parent5843a43c16e007193f5e26522d1e7368a0bdb2d7 (diff)
downloadgitlab-ce-945e0684afc3c22ac658dbb68005cb2ebf5ac51c.tar.gz
added date parameter for time trackinggitlab-ee-1312-time-spent-at
Diffstat (limited to 'app/models/concerns/time_trackable.rb')
-rw-r--r--app/models/concerns/time_trackable.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/concerns/time_trackable.rb b/app/models/concerns/time_trackable.rb
index b517ddaebd7..9f403d96ed5 100644
--- a/app/models/concerns/time_trackable.rb
+++ b/app/models/concerns/time_trackable.rb
@@ -9,7 +9,7 @@ module TimeTrackable
extend ActiveSupport::Concern
included do
- attr_reader :time_spent, :time_spent_user
+ attr_reader :time_spent, :time_spent_user, :spent_at
alias_method :time_spent?, :time_spent
@@ -24,6 +24,7 @@ module TimeTrackable
def spend_time(options)
@time_spent = options[:duration]
@time_spent_user = options[:user]
+ @spent_at = options[:spent_at]
@original_total_time_spent = nil
return if @time_spent == 0
@@ -55,7 +56,11 @@ module TimeTrackable
end
def add_or_subtract_spent_time
- timelogs.new(time_spent: time_spent, user: @time_spent_user)
+ timelogs.new(
+ time_spent: time_spent,
+ user: @time_spent_user,
+ spent_at: @spent_at
+ )
end
def check_negative_time_spent