diff --git a/Repositories/statistics/includes/inc.class.mysql.es.php b/Repositories/statistics/includes/inc.class.mysql.es.php index 7c9d8e1..f5853f2 100755 --- a/Repositories/statistics/includes/inc.class.mysql.es.php +++ b/Repositories/statistics/includes/inc.class.mysql.es.php @@ -144,8 +144,9 @@ // Create a result array $records = array(); //Build up the query +// NJS 2006-01-18: Added count of country_code. $query = " - select count(*) as count,month(request_date) as monthnum,date_format(request_date,'%b') as month,year(request_date) as year from view + select count(*) as count,count(distinct country_code) as countries,month(request_date) as monthnum,date_format(request_date,'%b') as month,year(request_date) as year from view $limit group by year(request_date),month(request_date) order by request_date desc "; @@ -226,8 +227,9 @@ $date_range = 'WHERE view_type = "download"'; } // End of addition -------------------------------------------------- + // NJS 2006-01-18: Added count of country_code. $query = " - select count(*) as count,archiveid,eprint_name from view + select count(*) as count,count(distinct country_code) as countries,archiveid,eprint_name from view $date_range group by archiveid order by count desc "; @@ -336,7 +338,8 @@ $month = (int) $month; $records = array(); $date_range = ''; - if($year>=2002 and $year<2005) { + // NJS 2006-01-18: Fixed upper year bound (was 2005). + if($year>=2002 and $year<2100) { if($month>0 and $month<=12) { $date_range = "AND year(request_date) = $year and month(request_date) = $month"; } else { @@ -346,8 +349,9 @@ if($range=='4w') { $date_range = "AND request_date >= date_sub(curdate(),INTERVAL 1 MONTH)"; } + // NJS 2006-01-18: Added count of country_code. $query = " - select count(*) as count,view_type from view + select count(*) as count,count(distinct country_code) as countries,view_type from view WHERE archiveid = $id $date_range group by view_type order by count desc