Include guest count in the summary
This commit is contained in:
parent
d8884704d8
commit
6c1bf75db8
@ -15,6 +15,8 @@ module Expenses
|
|||||||
expense_summary.variable,
|
expense_summary.variable,
|
||||||
expense_summary.variable_count,
|
expense_summary.variable_count,
|
||||||
expense_summary.total_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.confirmed as total,
|
||||||
expense_summary.fixed + expense_summary.variable * guest_count.projected as max_projected,
|
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
|
(expense_summary.fixed + expense_summary.variable * guest_count.confirmed) / guest_count.confirmed as per_person
|
||||||
|
@ -23,6 +23,8 @@ module Expenses
|
|||||||
expect(response["total_count"]).to be_zero
|
expect(response["total_count"]).to be_zero
|
||||||
expect(response["max_projected"]).to be_zero
|
expect(response["max_projected"]).to be_zero
|
||||||
expect(response["per_person"]).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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -41,6 +43,8 @@ module Expenses
|
|||||||
expect(response["total_count"]).to eq(2)
|
expect(response["total_count"]).to eq(2)
|
||||||
expect(response["max_projected"]).to eq(300)
|
expect(response["max_projected"]).to eq(300)
|
||||||
expect(response["per_person"]).to eq(150)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -58,6 +62,8 @@ module Expenses
|
|||||||
expect(response["total"]).to eq(2*300)
|
expect(response["total"]).to eq(2*300)
|
||||||
expect(response["total_count"]).to eq(2)
|
expect(response["total_count"]).to eq(2)
|
||||||
expect(response["max_projected"]).to eq(11*300)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -77,6 +83,8 @@ module Expenses
|
|||||||
expect(response["total_count"]).to eq(3)
|
expect(response["total_count"]).to eq(3)
|
||||||
expect(response["max_projected"]).to eq(100 + 200 + 11*50)
|
expect(response["max_projected"]).to eq(100 + 200 + 11*50)
|
||||||
expect(response["per_person"]).to eq(200)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user