FIX: makes report description optional

This commit is contained in:
Joffrey JAFFEUX 2018-05-14 16:34:56 +02:00 committed by GitHub
parent 83255d94d9
commit 34dbb32df4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -35,12 +35,14 @@ class Report
end
def as_json(options = nil)
description = I18n.t("reports.#{type}.description", default: "")
{
type: type,
title: I18n.t("reports.#{type}.title"),
xaxis: I18n.t("reports.#{type}.xaxis"),
yaxis: I18n.t("reports.#{type}.yaxis"),
description: I18n.t("reports.#{type}.description"),
description: description.presence ? description : nil,
data: data,
start_date: start_date&.iso8601,
end_date: end_date&.iso8601,