We've moved discussions to Discord

Reporting on number of subscribers per plan

I'm working on the administrate dashboard to add some (very) basic charts via Chartkick. What i'm trying to do is build a pie_chart that shows how many active subscribers there are for each of my plans. However, i'm coming unstuck and not sure if this could be done via a joins query or another way.

So if I keep with the basics, I can achieve this:

<%= pie_chart Pay::Subscription.group(:processor_plan).count, donut: true %>

This then gives me a pie_chart broken down by processor_plan, however the labels are showing the processor_plan. I would much rather this show the plan name, but i'm unsure how to include this in the query.

Thanks in advance for any support.
Chris Oliver
Hey Dan,

I'd just use Ruby's map to convert the processor_plan IDs to human readable names. You can use the Plan table to look those up, or you could make a hash to do the lookup as well.
Thanks Chris!
Notifications
You’re not receiving notifications from this thread.