aboutsummaryrefslogtreecommitdiffstats
path: root/web/nms.gathering.org/switches-json.pl
diff options
context:
space:
mode:
authorKnut Auvor Grythe <knut@auvor.no>2015-04-02 08:54:36 +0200
committerroot <root@einstein.tg15.gathering.org>2015-04-02 08:54:36 +0200
commit9f03931fce78a2fe2a21852f7228ea093493d60f (patch)
tree432ee0724559a8c4d696eaec01ea306ab4c5b6b6 /web/nms.gathering.org/switches-json.pl
parentd1eeb0c628ec5cbdb9649a241a02f97016b83015 (diff)
Update all maps to use the poll2 table
Diffstat (limited to 'web/nms.gathering.org/switches-json.pl')
-rwxr-xr-xweb/nms.gathering.org/switches-json.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/web/nms.gathering.org/switches-json.pl b/web/nms.gathering.org/switches-json.pl
index 0930d14..5635a02 100755
--- a/web/nms.gathering.org/switches-json.pl
+++ b/web/nms.gathering.org/switches-json.pl
@@ -11,6 +11,7 @@ my $dbh = nms::db_connect();
my %json = ();
my $q = $dbh->prepare('select switch,sysname,placement,zorder from switches natural join placements');
+my $q2 = $dbh->prepare('select distinct on (switch) switch,temp,time,sysname from switch_temp natural join switches order by switch,time desc');
$q->execute();
while (my $ref = $q->fetchrow_hashref()) {
$ref->{'placement'} =~ /\((-?\d+),(-?\d+)\),\((-?\d+),(-?\d+)\)/;
@@ -26,6 +27,11 @@ while (my $ref = $q->fetchrow_hashref()) {
};
}
+$q2->execute();
+while (my $ref = $q2->fetchrow_hashref()) {
+ $json{'switches'}{$ref->{'switch'}}{'temp'} = $ref->{'temp'};
+ $json{'switches'}{$ref->{'switch'}}{'time'} = $ref->{'time'};
+}
my $q = $dbh->prepare('select linknet,switch1,switch2 from linknets');
$q->execute();
while (my $ref = $q->fetchrow_hashref()) {