Skip to content

Commit

Permalink
/release/by_author_and_name: return one element
Browse files Browse the repository at this point in the history
There is no reason to return an arrayref with one element.
Changed the returned structure from:
{ total => ... , took => ... , releases => [ {RELEASE_DATA} ] }
to:
{ total => ... , took => ... , release => {RELEASE_DATA} }
  • Loading branch information
mickeyn committed Jun 29, 2017
1 parent e7e9845 commit 9773344
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/MetaCPAN/Document/Release.pm
Expand Up @@ -633,13 +633,13 @@ sub by_author_and_name {
);
return unless $ret->{hits}{total};

my $data = [ map { $_->{_source} } @{ $ret->{hits}{hits} } ];
my $data = $ret->{hits}{hits}[0]{_source};
single_valued_arrayref_to_scalar($data);

return {
took => $ret->{took},
releases => $data,
total => $ret->{hits}{total}
took => $ret->{took},
release => $data,
total => $ret->{hits}{total}
};
}

Expand Down

0 comments on commit 9773344

Please sign in to comment.