Skip to content

Commit

Permalink
/rating/by_distributions: change output structure
Browse files Browse the repository at this point in the history
Make the distributions output a hash.
  • Loading branch information
mickeyn committed Jul 4, 2017
1 parent dfd83dd commit ac145df
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/MetaCPAN/Document/Rating.pm
Expand Up @@ -93,13 +93,13 @@ sub by_distributions {
);
return unless $ret->{hits}{total};

my $data = [ map { $_->{key} => $_->{ratings_dist} }
@{ $ret->{aggregations}{ratings}{buckets} } ];
my %distributions = map { $_->{key} => $_->{ratings_dist} }
@{ $ret->{aggregations}{ratings}{buckets} };

return {
releases => $data,
total => $ret->{hits}{total},
took => $ret->{took}
distributions => \%distributions,
total => $ret->{hits}{total},
took => $ret->{took}
};
}

Expand Down

0 comments on commit ac145df

Please sign in to comment.