Commit d46b946e authored by Ruben Davila's avatar Ruben Davila

Add helper method #time_spent to Issuables.

This method returns the total spent time that the user has declared
through the `/spend` slash command.
parent c32e364c
......@@ -303,4 +303,8 @@ module Issuable
metrics = self.metrics || create_metrics
metrics.record!
end
def time_spent
timelogs.sum(:time_spent)
end
end
......@@ -255,7 +255,7 @@ module SlashCommands
end
command :estimate do |raw_duration|
begin
@updates[:estimate] = ChronicDuration.parse(raw_duration, default_unit: 'hours')
@updates[:time_estimate] = ChronicDuration.parse(raw_duration, default_unit: 'hours')
rescue ChronicDuration::DurationParseError
# do nothing
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