23 lines
352 B
Ruby
23 lines
352 B
Ruby
module Tables
|
|
class DiscomfortCalculator
|
|
private attr_reader :table
|
|
def initialize(table)
|
|
@table = table
|
|
end
|
|
|
|
def calculate
|
|
group_merging
|
|
end
|
|
|
|
private
|
|
|
|
def group_merging
|
|
10 * (number_of_groups - 1)
|
|
end
|
|
|
|
def number_of_groups
|
|
table.map(&:affinity_groups).flatten.uniq.count
|
|
end
|
|
end
|
|
end
|