Define an endpoint with a global summary of expenses and attendance #184

Merged
bustikiller merged 3 commits from dashboard into main 2024-12-11 22:44:35 +00:00
Showing only changes of commit 4e61ee2f22 - Show all commits

View File

@ -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