From 4e61ee2f22acc8cb0c231c16a0628c132c7ab7ec Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Wed, 11 Dec 2024 23:42:18 +0100 Subject: [PATCH] Include real data in the guests summary of the dashboard --- app/controllers/summary_controller.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb index f6f3daa..55983dc 100644 --- a/app/controllers/summary_controller.rb +++ b/app/controllers/summary_controller.rb @@ -3,6 +3,7 @@ class SummaryController < ApplicationController def index expense_summary = Expenses::TotalQuery.new(wedding: ActsAsTenant.current_tenant).call + guest_summary = Guest.group(:status).count render json: { expenses: { projected: { @@ -18,11 +19,11 @@ class SummaryController < ApplicationController } }, guests: { - total: 200, - confirmed: 100, - declined: 50, - tentative: 25, - invited: 25 + total: guest_summary.except('considered').values.sum, + confirmed: guest_summary['confirmed'].to_i, + declined: guest_summary['declined'].to_i, + tentative: guest_summary['tentative'].to_i, + invited: guest_summary['invited'].to_i } } end