Commit 50573a63 authored by Ruben Davila's avatar Ruben Davila

Small refactor.

parent d2b89ea7
...@@ -38,7 +38,6 @@ module Issuable ...@@ -38,7 +38,6 @@ module Issuable
has_many :label_links, as: :target, dependent: :destroy has_many :label_links, as: :target, dependent: :destroy
has_many :labels, through: :label_links has_many :labels, through: :label_links
has_many :todos, as: :target, dependent: :destroy has_many :todos, as: :target, dependent: :destroy
has_many :timelogs, as: :trackable, dependent: :destroy
has_one :metrics has_one :metrics
......
...@@ -12,6 +12,8 @@ module TimeTrackable ...@@ -12,6 +12,8 @@ module TimeTrackable
attr_reader :time_spent attr_reader :time_spent
alias_method :time_spent?, :time_spent alias_method :time_spent?, :time_spent
has_many :timelogs, as: :trackable, dependent: :destroy
end end
def spend_time=(args) def spend_time=(args)
...@@ -32,7 +34,7 @@ module TimeTrackable ...@@ -32,7 +34,7 @@ module TimeTrackable
private private
def valid_spend_time_args?(args) def valid_spend_time_args?(args)
return false unless [:seconds, :user].all? { |k| args.key?(k) } return false if [:seconds, :user].any? { |k| args[k].blank? }
# time to subtract exceeds the total time spent # time to subtract exceeds the total time spent
seconds = args[:seconds] seconds = args[:seconds]
......
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