Gave up and set time window to 24 hours. locations setup of for local testing
This commit is contained in:
1
python/pycomm.log
Normal file
1
python/pycomm.log
Normal file
@@ -0,0 +1 @@
|
||||
pycomm.ab_comm.clx WARNING 2016-01-25 14:45:25,488 (5, 'forward_close returned False')
|
||||
@@ -6,13 +6,13 @@ Created on Dec 8, 2015
|
||||
@author: Patrick McDonagh
|
||||
'''
|
||||
|
||||
from random import randint
|
||||
import time
|
||||
import sqlite3 as lite
|
||||
from pycomm.ab_comm.clx import Driver as ClxDriver
|
||||
import logging
|
||||
|
||||
con = lite.connect("/usr/db/data.db")
|
||||
# con = lite.connect("/usr/db/data.db")
|
||||
con = lite.connect('/Users/patrickjmcd/data.db')
|
||||
|
||||
|
||||
def readTag(addr, tag):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
var dbFile = "/usr/db/data.db"
|
||||
// var dbFile = "/usr/db/data.db"
|
||||
var dbFile = '/Users/patrickjmcd/data.db';
|
||||
// app.get('/json/add/:tag', fns.addTag); // Adds a tag to the scan list
|
||||
// app.get('/json/remove/:tag', fns.removeTag); // Removes a tag from the scan list
|
||||
// app.get('/json/val/:tag', fns.latestTagValue); // Gets the latest value of a single tag
|
||||
@@ -134,10 +135,9 @@ exports.seriesTagValues = function(req, res){
|
||||
var db = new sqlite3.Database(dbFile);
|
||||
|
||||
db.serialize(function(){
|
||||
var query = "SELECT * FROM vals WHERE tagID = ? AND dateAdded > DATETIME('now', '-? HOUR')";
|
||||
var query = "SELECT * FROM vals WHERE tagID = ? AND dateAdded > DATETIME('now', '-24 HOUR')";
|
||||
var prepQuery = db.prepare(query);
|
||||
// prepQuery.all(parseInt(req.params.tag), 6, function(err, rows){
|
||||
db.get(query, [parseInt(req.params.tag), 6], function(err, rows){
|
||||
prepQuery.all(parseInt(req.params.tag), function(err, rows){
|
||||
prepQuery.finalize();
|
||||
db.close();
|
||||
if (err){
|
||||
|
||||
Reference in New Issue
Block a user