pricecharts

track prices of consumer electronics
Log | Files | Refs | README

commit 7c0d3de71f046ef16bea9188746e622922d81dba
parent 9d7a63a1aefd4fd29628b5719b65ca71e040aa89
Author: kyle <kyle@getaddrinfo.net>
Date:   Sun,  8 Nov 2015 08:25:48 -0700

html: tweak about.html's status section

Diffstat:
Metc/pricesloth.css | 6++++++
Mps_html | 16++++++++--------
Mtt/about.tt | 16+++++++++-------
3 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/etc/pricesloth.css b/etc/pricesloth.css @@ -119,3 +119,9 @@ body { .logo_small { height: 0.7em; } + +/* used in about page to indicate online status */ +.online_text { + color: limegreen; + font-weight: bold; +} diff --git a/ps_html b/ps_html @@ -154,11 +154,6 @@ my ($prod_stale) = $dbh->selectrow_array(qq{select count(*) from products my ($r) = $dbh->selectrow_array("select count(*) from retailers"); -# XXX: this isn't right, it wont count parts with equal part numbers but -# different manufacturers -my ($have_prices) = $dbh->selectrow_array(qq{select count(distinct part_num) - from prices}); - # draw a graph of total number of products vs time my ($first_seen) = $dbh->selectrow_array("select first_seen from products order by first_seen limit 1"); my $num_weeks = (time - $first_seen) / (60 * 60 * 24 * 7); @@ -185,11 +180,16 @@ open my $svg_fh, ">", "$svg_path" or die "couldn't open $svg_path: $!"; print $svg_fh $svg->xmlify; close $svg_fh; -$vars = { nprice => format_number($nprice), +# this is supposed to work??? alternative sucks +# $THOUSANDS_SEP = '/'; +my $de = new Number::Format(-thousands_sep => ' ', + -decimal_point => '.'); + +$vars = { nprice => $de->format_number($nprice), nret => $r, nmanuf => $m, - nprod => format_number($p - $prod_stale), - nprod_stale => $prod_stale, no_prices => $p - $have_prices + nprod => $de->format_number($p - $prod_stale), + nprod_stale => $prod_stale }; $www->process("about.tt", $vars, "about.html") or die $www->error(), "\n"; diff --git a/tt/about.tt b/tt/about.tt @@ -25,14 +25,16 @@ absolute best time to buy a product easier.</p> </div> - <div class="column index_column"> + <div class="column"> <h2>Status</h2> - <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 - single price.</p> + <p><span class="online_text">Online</span>. + Currently, there are <ul> + <li><b>[% nprice %]</b> prices + <li><b>[% nprod %]</b> active products + (<b>[% nprod_stale %]</b> stale) + <li><b>[% nmanuf %]</b> manufacturers + <li><b>[% nret %]</b> retailers + </ul></p> <object data="/svg/history_summary.svg" type="image/svg+xml"> </object>