Skip to content

Commit

Permalink
drop invalid author lat/lon info
Browse files Browse the repository at this point in the history
  • Loading branch information
ranguard committed May 5, 2016
1 parent 3c0c4eb commit 7bd8d01
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/MetaCPAN/Script/Author.pm
Expand Up @@ -87,6 +87,25 @@ sub index_authors {
];
my $author = $type->new_document($put);
$author->gravatar_url; # build gravatar_url

# Do not import lat / lon's in the wrong order, or just invalid
if ( my $loc = $author->{location} ) {

my $lat = $loc->[1];
my $lon = $loc->[0];

if ( $lat > 90 or $lat < -90 ) {

# Invalid latitude
delete $author->{location};
}
elsif ( $lon > 180 or $lon < -180 ) {

# Invalid longitude
delete $author->{location};
}
}

$bulk->put($author);
}
$self->index->refresh;
Expand Down

0 comments on commit 7bd8d01

Please sign in to comment.