Skip to content

Commit

Permalink
Index bug summary data
Browse files Browse the repository at this point in the history
  • Loading branch information
rafl committed Jan 15, 2012
1 parent 3c83b89 commit 50bbc00
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/MetaCPAN/Document/Distribution.pm
Expand Up @@ -6,6 +6,7 @@ use namespace::autoclean;

has id => (is => 'ro', id => ['name']);
has name => (is => 'ro', required => 1);
has rt_bug_count => (is => 'ro');

__PACKAGE__->meta->make_immutable;

Expand Down
18 changes: 18 additions & 0 deletions lib/MetaCPAN/Script/Tickets.pm
Expand Up @@ -23,6 +23,24 @@ sub run {
$self->index_bug_summary($bug_summary);
}

sub index_bug_summary {
my ($self, $summary) = @_;

for my $dist (keys %{ $summary }) {
my $dist_data = $self->index->type('distribution')->inflate(0)->get({
name => $dist,
}) or next;

use Data::Dump 'pp';
pp $dist_data;

$self->index->type('distribution')->put({
%{ $dist_data->{_source} },
rt_bug_count => $summary->{$dist},
}, { refresh => 1 });
}
}

sub retrieve_bug_summary {
my ($self) = @_;

Expand Down

0 comments on commit 50bbc00

Please sign in to comment.