From a3949f09f09d9cde97c7146f617c8e03341fa3bc Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 4 Apr 2011 00:39:05 +0200 Subject: [PATCH] use city_koha to support different points in same city --- koha-import.pl | 3 ++- koha.pl | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/koha-import.pl b/koha-import.pl index aa7805b..b2ba4d1 100755 --- a/koha-import.pl +++ b/koha-import.pl @@ -174,12 +174,13 @@ select count(biblionumber) ,point(lat,lng) ,geo_city.city + ,geo_city.city_koha ,country into geo_count from geo_biblioitems join geo_city on city_koha = geo_biblioitems.city where length(geo_city.city) > 1 -group by geo_city.city, country, lat, lng +group by geo_city.city, country, lat, lng, city_koha order by count(biblionumber) desc }); diff --git a/koha.pl b/koha.pl index a0c110e..e5f981a 100755 --- a/koha.pl +++ b/koha.pl @@ -14,6 +14,8 @@ my $zoom = param('ZOOM') ; my $maxpix = 15 ; # Maximum pixels between click and point +my $limit_books = 100; # max. for one click + print qq{Content-type: text/xml\r\n\r\n}; print qq{\n} ; print qq!\n! ; @@ -37,7 +39,7 @@ if ( $point =~ /(.*),(.*)/ ) my $sql = qq{ select - city + city_koha ,country ,count ,point @@ -68,15 +70,18 @@ select from geo_city c join geo_biblioitems bi on bi.city = c.city_koha join biblio b on b.biblionumber = bi.biblionumber -where c.city = ? and country = ? +where c.city_koha = ? and country = ? group by author, title order by min(timestamp) -limit 100 +limit $limit_books }); $sth->execute( $city, $country ); my $rows = $sth->rows; - $rows = "more than $rows" if $rows == 100; + if ( $rows == $limit_books ) { + $rows = "more than $rows"; + $rows = $count if $count > $rows; + }; my $books = 'books'; $books = 'book' if $rows == 1; -- 2.20.1