aboutsummaryrefslogtreecommitdiffstats
path: root/bin/populate_bing_cache
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2015-01-19 16:20:55 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2015-01-19 16:35:36 +0000
commit2e8df1a5a6610c43e0c1bda15d018fa16738061b (patch)
treee06b0a33d399caf5ba0fb94186f609617496740e /bin/populate_bing_cache
parent7fa239a9c2122074bb65bbb0ac7d30d922a4f761 (diff)
Tidy up of bin directory.
Remove some unneeded scripts, move others to cobrand-specific directories.
Diffstat (limited to 'bin/populate_bing_cache')
-rwxr-xr-xbin/populate_bing_cache60
1 files changed, 0 insertions, 60 deletions
diff --git a/bin/populate_bing_cache b/bin/populate_bing_cache
deleted file mode 100755
index 17c8911d0..000000000
--- a/bin/populate_bing_cache
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-require 5.8.0;
-
-use Data::Dumper;
-
-use FixMyStreet::App;
-use FixMyStreet::Geocode::Bing;
-
-my $bing_culture = 'en-GB';
-
-my $reports = FixMyStreet::App->model('DB::Problem')->search(
- {
- geocode => undef,
- confirmed => { '!=', undef },
- latitude => { '!=', 0 },
- longitude => { '!=', 0 },
- },
- {
- select => [qw/id geocode confirmed latitude longitude/],
- order_by => { -desc => 'confirmed' }
- }
-);
-
-my $num_reports = $reports->count();
-print "Found $num_reports lacking geocode information\n";
-
-my $time_to_do = ( $num_reports * 10 ) / 60 / 60;
-if ( $time_to_do > 24 ) {
- my $days = $time_to_do / 24;
- my $hours = $time_to_do % 24;
- printf( "Should take %d days and %d hours to finish\n", $days, $hours );
-}
-elsif ( $time_to_do < 1 ) {
- printf( "Should take %d minutes to finish\n", $time_to_do * 60 );
-}
-else {
- my $mins = ( $num_reports * 10 ) / 60 % 60;
- printf( "Should take %d hours and %d minutes to finish\n",
- $time_to_do, $mins );
-}
-
-while ( my $report = $reports->next ) {
- $num_reports--;
- next unless $report->latitude && $report->longitude;
- next if $report->geocode;
-
- my $j = FixMyStreet::Geocode::Bing::reverse( $report->latitude,
- $report->longitude, $bing_culture );
-
- $report->geocode($j);
- $report->update;
-
- print "$num_reports left to populate\n" unless $num_reports % 100;
- sleep 10;
-}
-
-print "done\n";