Merge pull request 'Increase penalty for tables under minimum capacity' (#113) from increase-penalty-undercapacity-tables into main
Reviewed-on: #113
This commit is contained in:
commit
8d74d25574
@ -22,7 +22,7 @@ module Tables
|
|||||||
#
|
#
|
||||||
def table_size_penalty
|
def table_size_penalty
|
||||||
case table.size
|
case table.size
|
||||||
when 0...table.min_per_table then 2 * (table.min_per_table - table.size)
|
when 0...table.min_per_table then 5 * (table.min_per_table - table.size)
|
||||||
when table.min_per_table..table.max_per_table then 0
|
when table.min_per_table..table.max_per_table then 0
|
||||||
else 5 * (table.size - table.max_per_table)
|
else 5 * (table.size - table.max_per_table)
|
||||||
end
|
end
|
||||||
|
@ -49,13 +49,13 @@ module Tables
|
|||||||
context 'when the number of guests is one unit below the lower bound' do
|
context 'when the number of guests is one unit below the lower bound' do
|
||||||
let(:table) { Table.new(create_list(:guest, 4)) }
|
let(:table) { Table.new(create_list(:guest, 4)) }
|
||||||
|
|
||||||
it { expect(calculator.send(:table_size_penalty)).to eq(2) }
|
it { expect(calculator.send(:table_size_penalty)).to eq(5) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the number of guests is two units below the lower bound' do
|
context 'when the number of guests is two units below the lower bound' do
|
||||||
let(:table) { Table.new(create_list(:guest, 3)) }
|
let(:table) { Table.new(create_list(:guest, 3)) }
|
||||||
|
|
||||||
it { expect(calculator.send(:table_size_penalty)).to eq(4) }
|
it { expect(calculator.send(:table_size_penalty)).to eq(10) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the number of guests is one unit above the upper bound' do
|
context 'when the number of guests is one unit above the upper bound' do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user