X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=blobdiff_plain;f=web%2Fhtdocs%2Fdetails%2Fstats.mc;h=97eb639b48a62a77f1db26dcc9eb56918e7fdc5c;hp=354cb541f0904e4fa8bb0a3a87694377f534dbd1;hb=f823e57f7856227accbb4d57ed2923573640b7a1;hpb=c264ce63d81f0cc31a00599daa94dd477e91d6da diff --git a/web/htdocs/details/stats.mc b/web/htdocs/details/stats.mc index 354cb54..97eb639 100644 --- a/web/htdocs/details/stats.mc +++ b/web/htdocs/details/stats.mc @@ -1,4 +1,3 @@ -%# $Id: stats.mc,v 1.1 2006-12-14 17:35:44 mike Exp $ <%doc> Here are the headings in the Z-Spy version: The ten most commonly supported Bib-1 Use attributes @@ -17,8 +16,87 @@ couched searchges, but it would still be necessary to trawl the records in order to find all the results, so we just take the path of least resistance and look at all the records by hand. +<%args> +$query => undef +$reload => 0 + <%perl> -my $stats = new ZOOM::IRSpy::Stats("localhost:3313/IR-Explain---1"); -use Data::Dumper; -print "
", xml_encode(Dumper($stats)), "
\n"; +my $key = defined $query ? $query : ""; +my $from_cache = 1; +my $stats = $m->cache->get($key); +if (!defined $stats || $reload) { + $from_cache = 0; + my $db = ZOOM::IRSpy::connect_to_registry(); + $stats = new ZOOM::IRSpy::Stats($db, $query); + $m->cache->set($key, $stats, "1 day"); +} +

Statistics for <% xml_encode($stats->{host}) %>

+

<% $stats->{n} %> targets analysed + <% defined $query ? "for '" . xml_encode($query) . "'" : "" %>

+% if ($from_cache) { +

Reusing cached result

+% } else { +

Recalculating stats

+% } +<& table, stats => $stats, data => "bib1AccessPoints", + title => "The twenty most commonly supported Bib-1 Use attributes", + headings => [ "Attribute", "Name"], maxrows => 20, + col3 => sub { bib1_access_point(@_) } &> +<& table, stats => $stats, data => "recordSyntaxes", + title => "Record syntax support by database", + headings => [ "Record Syntax"], maxrows => 30 &> +<& table, stats => $stats, data => "explain", + title => "Explain Support", + headings => [ "Explain Category"] &> +<& table, stats => $stats, data => "z3950_init_opt", + title => "Z39.50 Protocol Services Support", + headings => [ "Service"] &> +<& table, stats => $stats, data => "domains", + title => "Top Domains", + headings => [ "Top Domain"] &> +<& table, stats => $stats, data => "implementation", + title => "Implementation", + headings => [ "Name" ], maxrows => 20 &> +%# +%# +<%def table> +<%args> +$stats +$data +$title +$maxrows => 10 +@headings +$col3 => undef + +

<% $title %>

+ + + +% foreach my $heading ("#", @headings, "# Targets") { + +% } + + + +<%perl> +my $hr; +$hr = $stats->{$data}; +my @sorted = sort { $hr->{$b} <=> $hr->{$a} || $a <=> $b } keys %$hr; +my $n = @sorted; $n = $maxrows if @sorted > 10; +foreach my $i (1..$n) { + my $key = $sorted[$i-1]; + + + + +% if (defined $col3) { + +% } + + +% } + +
<% xml_encode($heading) %>
<% $i %><% xml_encode(substr($key, 0, 54), "HUH?") %><% xml_encode(&$col3($key), "HUH2?") %><% xml_encode($hr->{$key}, "HUH3?") . " (" . + int(10000*$hr->{$key}/$stats->{n})/100 . "%)" %>
+