Include guest count in the summary

This commit is contained in:
Manuel Bustillo 2024-10-28 23:01:00 +01:00
parent d8884704d8
commit 6c1bf75db8
2 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,8 @@ module Expenses
expense_summary.variable,
expense_summary.variable_count,
expense_summary.total_count,
guest_count.confirmed as confirmed_guests,
guest_count.projected as projected_guests,
expense_summary.fixed + expense_summary.variable * guest_count.confirmed as total,
expense_summary.fixed + expense_summary.variable * guest_count.projected as max_projected,
(expense_summary.fixed + expense_summary.variable * guest_count.confirmed) / guest_count.confirmed as per_person

View File

@ -23,6 +23,8 @@ module Expenses
expect(response["total_count"]).to be_zero
expect(response["max_projected"]).to be_zero
expect(response["per_person"]).to be_zero
expect(response["confirmed_guests"]).to eq(2)
expect(response["projected_guests"]).to eq(2 + 4 + 5)
end
end
@ -41,6 +43,8 @@ module Expenses
expect(response["total_count"]).to eq(2)
expect(response["max_projected"]).to eq(300)
expect(response["per_person"]).to eq(150)
expect(response["confirmed_guests"]).to eq(2)
expect(response["projected_guests"]).to eq(2 + 4 + 5)
end
end
@ -58,6 +62,8 @@ module Expenses
expect(response["total"]).to eq(2*300)
expect(response["total_count"]).to eq(2)
expect(response["max_projected"]).to eq(11*300)
expect(response["confirmed_guests"]).to eq(2)
expect(response["projected_guests"]).to eq(2 + 4 + 5)
end
end
@ -77,6 +83,8 @@ module Expenses
expect(response["total_count"]).to eq(3)
expect(response["max_projected"]).to eq(100 + 200 + 11*50)
expect(response["per_person"]).to eq(200)
expect(response["confirmed_guests"]).to eq(2)
expect(response["projected_guests"]).to eq(2 + 4 + 5)
end
end
end