Increase penalty for tables under minimum capacity
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 56s
Add copyright notice / copyright_notice (pull_request) Successful in 2m1s
Run unit tests / unit_tests (pull_request) Successful in 3m44s

This commit is contained in:
Manuel Bustillo 2024-11-10 18:40:26 +01:00
parent b084328d79
commit 5b36526c59
2 changed files with 3 additions and 3 deletions

View File

@ -22,7 +22,7 @@ module Tables
#
def table_size_penalty
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
else 5 * (table.size - table.max_per_table)
end

View File

@ -49,13 +49,13 @@ module Tables
context 'when the number of guests is one unit below the lower bound' do
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
context 'when the number of guests is two units below the lower bound' do
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
context 'when the number of guests is one unit above the upper bound' do