X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Fquery_age;h=a115bbdd562dd53286be49ff175f5519f366cd28;hb=ac1cf45e4672ac30f232cee92e60eb1a2d17a5c5;hp=7cfe54e291799e6c8daa53ec0207c0f4d37eeead;hpb=6302552bfa5844eddb7c26386c9995733f0a5174;p=ypp-sc-tools.db-live.git
diff --git a/yarrg/web/query_age b/yarrg/web/query_age
index 7cfe54e..a115bbd 100644
--- a/yarrg/web/query_age
+++ b/yarrg/web/query_age
@@ -47,11 +47,12 @@ $dbh
my $now= time;
my $sth= $dbh->prepare("SELECT archipelago, islandid, islandname, timestamp
- FROM uploads NATURAL JOIN islands
+ FROM uploads JOIN islands USING (islandid)
ORDER BY archipelago, islandname");
$sth->execute();
%perl>
+
<& SELF:pageload &>
<%method pageload>
@@ -69,19 +70,17 @@ $sth->execute();
$now
$fetchrow
%args>
-
+
Archipelago
| Island
| Age
- |
% my $row;
% my %da_ages;
% my %ts_sortkeys;
% $da_ages{'id_loaded'}= 0;
% my $rowix= 0;
% while ($row= $fetchrow->()) {
-% print STDERR "$row\n";
% my $rowid= "id_$row->{'islandid'}";
% my $cellid= "c$rowid";
% my $age= $now - $row->{'timestamp'};
@@ -124,6 +123,7 @@ Time since this page loaded:
var now= Date.now();
debug('updating now='+now);
for (var ageid in <% $jsprefix %>ages) {
+ if (!<% $jsprefix %>ages.hasOwnProperty(ageid)) continue;
var oldage= <% $jsprefix %>ages[ageid];
var el= document.getElementById(<% $elemidprefix %>ageid);
var age= oldage + (now - da_pageload) / 1000;
@@ -142,6 +142,7 @@ Time since this page loaded:
<& "lookup:formhidden", ours => sub { 0; } &>
+
<%init>
use POSIX;
use CommodsWeb;