aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-10-30 20:28:41 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-10-30 20:28:41 +0100
commita949af38a33cd08577ab91d6c5eb418520daefc8 (patch)
tree8251a36420396e2b26559c19d65da785f5e5b39b /src
parentecb664a8550ee787a593db6cf45907100a875a54 (diff)
downloaddiller-server-a949af38a33cd08577ab91d6c5eb418520daefc8.tar.gz
diller-server-a949af38a33cd08577ab91d6c5eb418520daefc8.tar.bz2
diller-server-a949af38a33cd08577ab91d6c5eb418520daefc8.tar.xz
diller-server-a949af38a33cd08577ab91d6c5eb418520daefc8.zip
web:
o Adding 'time ago' for each value. o Adding 'reload' button for a property.
Diffstat (limited to 'src')
-rw-r--r--src/DillerDao.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/DillerDao.js b/src/DillerDao.js
index 98b6e6e..3a6601f 100644
--- a/src/DillerDao.js
+++ b/src/DillerDao.js
@@ -71,7 +71,7 @@ function DillerDao(tx) {
function updateHourAggregatesForProperty(propertyId, timestamp) {
return tx.none('DELETE FROM value_by_hour WHERE property=$1 AND timestamp=DATE_TRUNC(\'hour\', $2::TIMESTAMPTZ)', [propertyId, timestamp])
.then(function() {
- return tx.one('INSERT INTO value_by_hour(property, timestamp, count, max, min, avg) ' +
+ return tx.oneOrNone('INSERT INTO value_by_hour(property, timestamp, count, max, min, avg) ' +
'SELECT property, DATE_TRUNC(\'hour\', timestamp) AS timestamp, COUNT(value_numeric) AS count, MAX(value_numeric) AS max, MIN(value_numeric) AS min, AVG(value_numeric) AS avg ' +
'FROM value WHERE property=$1 AND DATE_TRUNC(\'hour\', timestamp)=DATE_TRUNC(\'hour\', $2::TIMESTAMPTZ) AND value_numeric IS NOT NULL ' +
'GROUP BY property, DATE_TRUNC(\'hour\', timestamp) ' +
@@ -82,7 +82,7 @@ function DillerDao(tx) {
function updateMinuteAggregatesForProperty(propertyId, timestamp) {
return tx.none('DELETE FROM value_by_minute WHERE property=$1 AND timestamp=DATE_TRUNC(\'minute\', $2::TIMESTAMPTZ)', [propertyId, timestamp])
.then(function() {
- return tx.one('INSERT INTO value_by_minute(property, timestamp, count, max, min, avg) ' +
+ return tx.oneOrNone('INSERT INTO value_by_minute(property, timestamp, count, max, min, avg) ' +
'SELECT property, DATE_TRUNC(\'minute\', timestamp) AS timestamp, COUNT(value_numeric) AS count, MAX(value_numeric) AS max, MIN(value_numeric) AS min, AVG(value_numeric) AS avg ' +
'FROM value ' +
'WHERE property=$1 AND DATE_TRUNC(\'minute\', timestamp)=DATE_TRUNC(\'minute\', $2::TIMESTAMPTZ) AND value_numeric IS NOT NULL ' +