 		vote_value: est
 	return ret
 
-estimated_votes = ->
+estimated_votes = (data) ->
 	est = []
 	for vote_event_id, _ of data.vote_events
 		for voter_id, _ of data.persons
-			est.push estimate_vote voter_id, vote_event_id
+			est.push estimate_vote data, voter_id, vote_event_id
 	return est
 
-my_agreements = (me) ->
-	ests = estimated_votes()
-	my_votes = getWhere data.votes, voter_id: me
+voter_agreements = (data, voter_id) ->
+	ests = estimated_votes(data)
+	my_votes = getWhere data.votes, voter_id: voter_id
 	for person_id, person of data.persons
 		paggs = []
 		for _, my_vote of my_votes
-			other_vote = R.values getWhere ests,
+			other_vote = getOneWhere ests,
 				voter_id: person_id
 				vote_event_id: my_vote.vote_event_id
-			other_vote = other_vote[0]
 			continue unless other_vote?
 			my_value = my_vote.vote_value
 			other_value = other_vote.vote_value

			voter_id: person_id
			agreement: R.mean paggs
		yield res
	#console.log my_votes
if require.main == module
	console.log Array.from my_agreements('user1')

R = require 'ramda'

###
data =
	motions:
		guggis_kamu:
