Skip to content

Commit

Permalink
Merge pull request #705 from metacpan/mickey/favorite_agg_by_distirbu…
Browse files Browse the repository at this point in the history
…tions_endpoint

/favorite/agg_by_distributions: change result structure
  • Loading branch information
mickeyn committed Jun 30, 2017
2 parents b0df91f + 29742d2 commit c2bd56c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/MetaCPAN/Document/Favorite.pm
Expand Up @@ -159,18 +159,18 @@ sub agg_by_distributions {
body => $body,
);

my @favorites = map { $_->{key} => $_->{doc_count} }
my %favorites = map { $_->{key} => $_->{doc_count} }
@{ $ret->{aggregations}{favorites}{buckets} };

my @myfavorites;
my %myfavorites;
if ($user) {
@myfavorites = map { $_->{key} => $_->{doc_count} }
%myfavorites = map { $_->{key} => $_->{doc_count} }
@{ $ret->{aggregations}{myfavorites}{entries}{buckets} };
}

return {
favorites => \@favorites,
myfavorites => \@myfavorites,
favorites => \%favorites,
myfavorites => \%myfavorites,
took => $ret->{took},
};
}
Expand Down

0 comments on commit c2bd56c

Please sign in to comment.