[Bps-public-commit] r11382 - SVN-PropDB/lib/Prophet/Resolver
clkao at bestpractical.com
clkao at bestpractical.com
Wed Apr 2 00:46:38 EDT 2008
Author: clkao
Date: Wed Apr 2 00:46:37 2008
New Revision: 11382
Modified:
SVN-PropDB/lib/Prophet/Resolver/FromResolutionDB.pm
Log:
fix voting.
Modified: SVN-PropDB/lib/Prophet/Resolver/FromResolutionDB.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Resolver/FromResolutionDB.pm (original)
+++ SVN-PropDB/lib/Prophet/Resolver/FromResolutionDB.pm Wed Apr 2 00:46:37 2008
@@ -15,7 +15,9 @@
my $res = Prophet::Collection->new( handle => $resdb->handle,
type => '_prophet_resolution-'.$conflicting_change->cas_key );
$res->matching(sub { 1 } );
- return unless @{ $res->as_array_ref};
+ return unless @{$res->as_array_ref};
+
+# return unless scalar @{ $res->as_array_ref };
my %answer_map;
my %answer_count;
@@ -23,9 +25,10 @@
for my $answer (@{$res->as_array_ref}) {
my $key = md5_hex(YAML::Syck::Dump($answer->get_props));
$answer_map{$key} ||= $answer;
- $answer_map{$key}++;
+ $answer_count{$key}++;
}
- my $best = (sort { $answer_map{$b} <=> $answer_map{$a} } keys %answer_map)[0];
+ my $best = (sort { $answer_count{$b} <=> $answer_count{$a} } keys %answer_map)[0];
+
my $answer = $answer_map{ $best };
my $resolution = Prophet::Change->new_from_conflict($conflicting_change);
More information about the Bps-public-commit
mailing list