Commit 877f6994 authored by Ruben Davila's avatar Ruben Davila

Add helper methods to show time in a human format.

Also added new attributes related to time tracking to the JSON payload.
parent 71a9b688
......@@ -75,7 +75,7 @@ class Projects::IssuesController < Projects::ApplicationController
respond_to do |format|
format.html
format.json do
render json: @issue.to_json(include: [:milestone, :labels])
render json: @issue.to_json(include: [:milestone, :labels], methods: [:total_time_spent, :human_total_time_spent, :human_time_estimate])
end
end
end
......
......@@ -40,6 +40,14 @@ module TimeTrackable
timelogs.sum(:time_spent)
end
def human_total_time_spent
ChronicDuration.output(total_time_spent, format: :short)
end
def human_time_estimate
ChronicDuration.output(time_estimate, format: :short)
end
private
def reset_spent_time
......
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