Add a conflict coefficient representation as a hash

This commit is contained in:
Petko Bordjukov 2016-10-05 13:28:56 +03:00
parent e66bafdc55
commit 63a920a88b
1 changed files with 11 additions and 0 deletions

View File

@ -7,6 +7,17 @@ class ConflictCoefficient
end
end
def self.all_as_hash
conflicts_hash = {}
all.each do |coefficient|
conflicts_hash[coefficient.left] = {} unless conflicts_hash[coefficient.left]
conflicts_hash[coefficient.left][coefficient.right] = coefficient.per_cent
end
conflicts_hash
end
def conflicts
@conflicts ||= talk_preferences.select do |talk_preference|
talk_preference.include_all? [@left, @right]