commit c3159d06dfb41ddafef074ff5121d9fb6c0ea178
parent 0d0f50d72bc58dc1a99dd79605d82beccc99c0a3
Author: kyle <kyle@getaddrinfo.net>
Date: Tue, 3 Nov 2015 22:37:51 -0700
html: add total number of prices to about.html
Diffstat:
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/DEPS.openbsd b/DEPS.openbsd
@@ -9,6 +9,7 @@ p5-HTML-Grabber
p5-IO-Tee
p5-Lingua-EN-Inflect
p5-Math-MatrixReal
+p5-Number-Format
p5-SVG
p5-Template
p5-Template-Plugin-POSIX
diff --git a/ps_html b/ps_html
@@ -9,6 +9,7 @@ use Data::Dumper;
use Getopt::Std;
use Lingua::EN::Inflect qw(PL);
use Math::MatrixReal;
+use Number::Format qw(:subs :vars);
use POSIX;
use PriceSloth;
use SVG;
@@ -146,6 +147,7 @@ $www->process("index.tt", $vars, "index.html")
#
my ($p, $m) = $dbh->selectrow_array(qq{select count(*),
count(distinct manufacturer) from products});
+my ($nprice) = $dbh->selectrow_array("select count(*) from prices");
# anything we haven't seen for over 30 days is stale
my ($prod_stale) = $dbh->selectrow_array(qq{select count(*) from products
@@ -184,7 +186,10 @@ open my $svg_fh, ">", "$svg_path" or die "couldn't open $svg_path: $!";
print $svg_fh $svg->xmlify;
close $svg_fh;
-$vars = { nret => $r, nmanuf => $m, nprod => $p - $prod_stale,
+$vars = { nprice => format_number($nprice),
+ nret => $r,
+ nmanuf => $m,
+ nprod => format_number($p - $prod_stale),
nprod_stale => $prod_stale, no_prices => $p - $have_prices
};
$www->process("about.tt", $vars, "about.html") or die $www->error(), "\n";
diff --git a/tt/about.tt b/tt/about.tt
@@ -27,7 +27,8 @@
<div class="column index_column">
<h2>Status</h2>
- <p>Online. Currently tracking <b>[% nprod %]</b> products,
+ <p>Online. Currently tracking <b>[% nprice %]</b> prices,
+ <b>[% nprod %]</b> products,
<b>[% nmanuf %]</b> manufacturers, and
<b>[% nret %]</b> retailers. There are <b>[% nprod_stale %]</b>
stale products and <b>[% no_prices %]</b> products don't have a