mirror of
https://gitlab.silvrtree.co.uk/martind2000/censis-archive.git
synced 2025-02-25 13:23:34 +00:00
”2016-09-01”
This commit is contained in:
parent
3e03f8cf42
commit
c5dd4bb9c8
@ -42,6 +42,21 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
getBranch: function(ts) {
|
||||||
|
const y = ts.getFullYear().toString();
|
||||||
|
const m = ts.getMonth().toString();
|
||||||
|
const d = ts.getDate().toString();
|
||||||
|
|
||||||
|
if (this.dateTree.hasOwnProperty(y)) {
|
||||||
|
if (this.dateTree[y].hasOwnProperty(m)) {
|
||||||
|
return this.dateTree[y][m][d];
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
findOccupancy: function(ts) {
|
findOccupancy: function(ts) {
|
||||||
/*
|
/*
|
||||||
Get a branch from the date tree and see if the reduced set of records has a matching timestamp..
|
Get a branch from the date tree and see if the reduced set of records has a matching timestamp..
|
||||||
@ -49,9 +64,9 @@
|
|||||||
var count = 0;
|
var count = 0;
|
||||||
var tsDate = new Date(ts);
|
var tsDate = new Date(ts);
|
||||||
var tsMS = tsDate.getTime();
|
var tsMS = tsDate.getTime();
|
||||||
var branch = this.dateTree[tsDate.getFullYear().toString()][tsDate.getMonth().toString()][tsDate.getDate().toString()];
|
var branch = this.getBranch(tsDate);
|
||||||
|
|
||||||
if (typeof branch === 'undefined') {
|
if (typeof branch === 'undefined' || branch === 'null') {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
_(branch).each(function(item) {
|
_(branch).each(function(item) {
|
||||||
@ -151,10 +166,10 @@
|
|||||||
|
|
||||||
}, decoder: function(data) {
|
}, decoder: function(data) {
|
||||||
var _obj = {};
|
var _obj = {};
|
||||||
var _data = window.atob(data).split('');
|
// var _data = window.atob(data).split('');
|
||||||
|
|
||||||
//var bytes = _data.map(i => i.charCodeAt());
|
//Var bytes = _data.map(i => i.charCodeAt());
|
||||||
/*
|
/*
|
||||||
_obj.light = parseInt('0x' + ('0' + bytes[0]).substr(-2) + ('0' + bytes[1]).substr(
|
_obj.light = parseInt('0x' + ('0' + bytes[0]).substr(-2) + ('0' + bytes[1]).substr(
|
||||||
-2));
|
-2));
|
||||||
_obj.co2 = parseInt(_data[2] + _data[3] + _data[4] + _data[5] + _data[6],
|
_obj.co2 = parseInt(_data[2] + _data[3] + _data[4] + _data[5] + _data[6],
|
||||||
|
@ -19,15 +19,13 @@ var cn = {
|
|||||||
|
|
||||||
// ElephantSql settings
|
// ElephantSql settings
|
||||||
|
|
||||||
/*
|
/*var cn = {
|
||||||
var cn = {
|
|
||||||
host: 'jumbo.db.elephantsql.com',
|
host: 'jumbo.db.elephantsql.com',
|
||||||
port: 5432,
|
port: 5432,
|
||||||
database: 'amlrxqev',
|
database: 'amlrxqev',
|
||||||
user: 'amlrxqev',
|
user: 'amlrxqev',
|
||||||
password: 'K11cvCplk0--oNafsYj4ISN-rVQmVS3y'
|
password: 'K11cvCplk0--oNafsYj4ISN-rVQmVS3y'
|
||||||
};
|
};*/
|
||||||
*/
|
|
||||||
|
|
||||||
exports.dbConnection = pgp(cn);
|
exports.dbConnection = pgp(cn);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user