Add a conflict coefficient representation as a hash
This commit is contained in:
parent
e66bafdc55
commit
63a920a88b
|
@ -7,6 +7,17 @@ class ConflictCoefficient
|
||||||
end
|
end
|
||||||
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
|
def conflicts
|
||||||
@conflicts ||= talk_preferences.select do |talk_preference|
|
@conflicts ||= talk_preferences.select do |talk_preference|
|
||||||
talk_preference.include_all? [@left, @right]
|
talk_preference.include_all? [@left, @right]
|
||||||
|
|
Loading…
Reference in New Issue