Simplify method to get chart data

This commit is contained in:
Javi Martín
2024-04-24 01:27:16 +02:00
parent 1edf0d937d
commit 4e72cbe42e

View File

@@ -16,12 +16,10 @@ class Admin::Stats::ChartComponent < ApplicationComponent
end
def chart_data(opt = {})
data = nil
if opt[:id].present?
data = { opt[:id] => true }
{ opt[:id] => true }
elsif opt[:event].present?
data = { event: opt[:event] }
{ event: opt[:event] }
end
data
end
end